ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro help (https://www.excelbanter.com/excel-discussion-misc-queries/251613-macro-help.html)

puiuluipui

Macro help
 
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!

Mike H

Macro help
 
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

"puiuluipui" wrote:

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!


Mike H

Macro help
 
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

"Mike H" wrote:

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

"puiuluipui" wrote:

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!


puiuluipui

Macro help
 
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

"puiuluipui" wrote:

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!



All times are GMT +1. The time now is 07:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com