![]() |
Autofill with Column as a variable
I want to autofill a range of cells from row 3 to 9 in a given column just
like this Range("B3").Select Selection.AutoFill Destination:=Range("B3:B9") When I use a variable the autofill returns an "Autofill method of range class failed" error. Need help please Cells(3, LastCol ).Select Selection.AutoFill Destination:=Range(Cells(3, LastCol), Cells(9, LastCol )) Thanks in adavance |
Autofill with Column as a variable
Have you tried
Range("B3:B9")= Range("B3") -- HTH, Barb Reinhardt "LuisE" wrote: I want to autofill a range of cells from row 3 to 9 in a given column just like this Range("B3").Select Selection.AutoFill Destination:=Range("B3:B9") When I use a variable the autofill returns an "Autofill method of range class failed" error. Need help please Cells(3, LastCol ).Select Selection.AutoFill Destination:=Range(Cells(3, LastCol), Cells(9, LastCol )) Thanks in adavance |
Autofill with Column as a variable
Thanks Barb,
I just tried but it doesn't work. |
Autofill with Column as a variable
Have you tried Just
Range("B3:B9").Select |
Autofill with Column as a variable
i usually do something like this:
Sub test() Dim lastcol As Long lastcol = 4 Dim ws As Worksheet Set ws = Worksheets("Sheet1") With ws .Cells(3, lastcol).AutoFill Destination:=.Range(.Cells(3, lastcol), _ .Cells(9, lastcol)) End With End Sub -- Gary "LuisE" wrote in message ... I want to autofill a range of cells from row 3 to 9 in a given column just like this Range("B3").Select Selection.AutoFill Destination:=Range("B3:B9") When I use a variable the autofill returns an "Autofill method of range class failed" error. Need help please Cells(3, LastCol ).Select Selection.AutoFill Destination:=Range(Cells(3, LastCol), Cells(9, LastCol )) Thanks in adavance |
Autofill with Column as a variable
wordwrap!
Sub test() Dim lastcol As Long lastcol = 4 Dim ws As Worksheet Set ws = Worksheets("Sheet1") With ws .Cells(3, lastcol).AutoFill Destination:=.Range(.Cells(3, lastcol),_ .Cells(9, lastcol)) End With End Sub -- Gary "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... i usually do something like this: Sub test() Dim lastcol As Long lastcol = 4 Dim ws As Worksheet Set ws = Worksheets("Sheet1") With ws .Cells(3, lastcol).AutoFill Destination:=.Range(.Cells(3, lastcol), _ .Cells(9, lastcol)) End With End Sub -- Gary "LuisE" wrote in message ... I want to autofill a range of cells from row 3 to 9 in a given column just like this Range("B3").Select Selection.AutoFill Destination:=Range("B3:B9") When I use a variable the autofill returns an "Autofill method of range class failed" error. Need help please Cells(3, LastCol ).Select Selection.AutoFill Destination:=Range(Cells(3, LastCol), Cells(9, LastCol )) Thanks in adavance |
All times are GMT +1. The time now is 12:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com