ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AutoFill Using a macro (https://www.excelbanter.com/excel-programming/371015-autofill-using-macro.html)

Richard[_2_]

AutoFill Using a macro
 
I have a macro that will take the formula that that I have in cell B2 and I
need it to be able to do an autofill for me, any suggestions on how to
accomplish this? So far I have the following code:

Selection.AutoFill Destination:=Range("G2:G50")
Range("G2:G50").Select
Range("G2").Select

I don't want it to always autofill to G50 if I can help it, any suggestions?

Richard

Harald Staff

AutoFill Using a macro
 
How would the code know how far down you want to fill ? You want to tell it,
or is there a pattern somewhere ?

Best wishes Harald

"Richard" <Richard @discussions.microsoft.com skrev i melding
...
Selection.AutoFill Destination:=Range("G2:G50")


I don't want it to always autofill to G50 if I can help it, any

suggestions?



Don Guillett

AutoFill Using a macro
 
Wasn't this answered in another thread very recently?


'br = Cells(Rows.Count, "b").End(xlUp).Row
br=33 'or whatever number you like. See Dave's post
Cells(1, "b").autofill Destination:=Range(Cells(1, "b"), Cells(br, "b"))

--
Don Guillett
SalesAid Software

"Richard" <Richard @discussions.microsoft.com wrote in message
...
I have a macro that will take the formula that that I have in cell B2 and I
need it to be able to do an autofill for me, any suggestions on how to
accomplish this? So far I have the following code:

Selection.AutoFill Destination:=Range("G2:G50")
Range("G2:G50").Select
Range("G2").Select

I don't want it to always autofill to G50 if I can help it, any
suggestions?

Richard





All times are GMT +1. The time now is 01:29 PM.

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