Macro to fill down in a range

Solved/Closed
lee - Dec 17, 2010 at 02:48 PM
 lee - Dec 21, 2010 at 09:10 AM
Hello,

Thanks to all who provide help on this site. I'm new to writing macros so hopefully you might be able to steer me in the right direction with a macro. I have data that I copy in each week to the first seven columns and then add formulas in columns to the right and copy them down to the last row used. Each week the list can be 70 rows or 700. So I've tried to setup a marco to fill down my formula to the last row. I found a great piece of a macro on this site to find the last row number that has data. buidling on the macro I tried to set the range to filldown using the value of the last row used. however I keep getting a compile error when I use the rNum to indicate my row. Below is what I've tried.

Thanks for all your help in advance

Lee


Sub filldown()
Dim rNum As Long
rNum = Cells.Find(What:="*", After:=Range("a1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row


Range("H1").Select
ActiveCell.FormulaR1C1 = "=RC[-2]&"" 48"""
Range("H1").Select
Range.("H1",cells(rNum,8).select
Selection.filldown

End Sub



2 responses

Change this line of code.

Incorrect:
Range.("H1",cells(rNum,8).select


Change to this....correct:
Range("H1", Cells(rNum, 8)).Select
0
Thanks. It works perfect now!!!

Lee
0