MrExcel Publishing
Your One Stop for Excel Tips & Solutions

highlight a range using a variable

Posted by Jeanne on December 26, 2001 4:32 PM

I have to add a total column ( I'm using K column ),in cell k1 I am adding a formula =e1*g1, now I need to find the last cell I'm using ActiveSheet.Range("g1").End(xlDown).Offset(0, 4).Select this happens to be k5120, but each month this will change. How do I highlight k1 through this last cell to do a fill down?


Posted by Juan Pablo G. on December 26, 2001 4:42 PM

You're pretty close... how about this ?

Range("K1:K" & Range("E65536").End(xlUp).Row).FillDown

Juan Pablo G.

Posted by Jacob on December 26, 2001 4:43 PM

To find the last cell use this

LastRow = range("G65536").end(xlup).row

this will give you the last row of data

the do this


Selection.AutoFill Destination:=Range("K1:K" & LastRow), Type:=xlFillDefault

Hope this helps