************************** Public Sub SetFormulas() Dim objWS As Worksheet Dim objFormulaWS As Worksheet Dim objColumn As Range Dim objCell As Range Dim i As Long Dim j As Integer Dim k As Integer
Set objWS = Sheets(1) Set objFormulaWS = Sheets(2) Set objColumn = objWS.Columns("A:A")
j = 1
For i = 1 To objColumn.Cells.Count Set objCell = objColumn.Cells(i, 1) If objCell.Value <> "" Then objFormulaWS.Cells(i, 1).Formula = "=" & objWS.Name & "!A" & j j = j + 3 k = k + 1 If k = 3 Then k = 0 j = j - 8 End If Else Exit For End If Next i
Set objWS = Nothing Set objFormulaWS = Nothing Set objColumn = Nothing Set objCell = Nothing End Sub ****************
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.