AutoFill Using a macro

R

Richard

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
 
H

Harald Staff

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 said:
Selection.AutoFill Destination:=Range("G2:G50")
I don't want it to always autofill to G50 if I can help it, any
suggestions?
 
D

Don Guillett

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"))
 

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