Macro help

P

puiuluipui

Hi, i need a macro to drag down some cells till the last active cell in "G"
column.

Ex:
M N O
08:00:00 12:30:00 08:30:00

I need to select M1:O1 and to drag down till the last cell with some data in
column "G".

Can this be done?
Thanks!
 
M

Mike H

Hi,

Try this

Sub FillUp()
Dim x As Long
lastrow = Cells(Cells.Rows.Count, "G").End(xlUp).Row
Range("M1:O1").AutoFill _
Destination:=Range("M1:O" & lastrow), Type:=xlFillDefault
End Sub

Mike
 
M

Mike H

Hi,

I meant

Sub FillUp()
Dim lastrow As Long
lastrow = Cells(Cells.Rows.Count, "G").End(xlUp).Row
Range("M1:O1").AutoFill _
Destination:=Range("M1:O" & lastrow), Type:=xlFillDefault
End Sub

Mike
 
P

puiuluipui

Works perfect!
Thanks Mike!

"Mike H" a scris:
Hi,

Try this

Sub FillUp()
Dim x As Long
lastrow = Cells(Cells.Rows.Count, "G").End(xlUp).Row
Range("M1:O1").AutoFill _
Destination:=Range("M1:O" & lastrow), Type:=xlFillDefault
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top