View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default coding for variable rows

Depends somewhat on what you are doing, eg FormulaR1C1 might work better.
following just for ideas -

Sub test()
Dim nLastRow As Long

' sample data in col-A
For i = 2 To 11
n = n + 10
Cells(i, 1).Value = n
Next

nLastRow = Range("A65536").End(xlUp).Row

Range("B2:B" & nLastRow).Value = 5

Range("H2:H" & nLastRow).Formula = "=A2+B2"
Range("I2:I" & nLastRow).Formula = "=H2 * 10"

End Sub

Regards,
Peter T

"Brad K." wrote in message
...
I am trying work on sheet that has data pasted to it that always has the

same
columns but rows vary each time. I need to enter a value into "B" column

and
a formula into "H" & "I" for each row that has data. I have a couple of
macros that do most this, but can't consistently make it work. Any
suggestions?
Thanks,
Brad K.