Reputation: 25
I have a question about saving the rownumber and then filling data with it in the next for loop like below. However, when I run this, it runs the code to find the LastRow again which then does not exist anymore as it's empty.
Sub kolomE()
Dim i, j As Integer
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Range("E3:E3" & LastRow).ClearContents
Range("E3:E3" & LastRow) = "&omegaOne="
End Sub
So I want it to fill the cells it cleared with .ClearContents to fill it with "&omegaOne="
Upvotes: 0
Views: 3047
Reputation: 1521
You forgot to erase row number from your ranges. It should be:
Range("E3:E" & LastRow).ClearContents
Range("E3:E" & LastRow).Value = "&omegaOne="
Upvotes: 1