Range question
Dim lastrow As Long
Dim lastcol As Long
lastrow = Range("A" & Rows.Count).End(xlUp).Row
lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
Range("B2").Resize(lastrow - 1, lastcol - 1).Formula = "=1+1"
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"Still Learning" wrote in message
...
Hello,
I have a spreadsheet with dates going across in row 1 and names going down
in column A. The number of dates and the number of names are variable and
change each time I run this macro. I want to use a fill macro that will
fill
a single formula down to the last row and then also fill it across to the
last column.
To get my formula to fill down to the last row in column A I'm using this
code:
Sub Fill()
lastrow = Range("A65536").End(xlUp).Row
Range("B2:B" & lastrow).Formula = "=1+1"
So this will fill it down, but how can I add to this so I can select the
recently filled down formulas and drag them across to the last column that
has dates in it?
THANK YOU FOR YOUR HELP!!!!
|