Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoFill Problem 1

Status
Not open for further replies.

jupops

Technical User
May 15, 2003
72
GB
Good Evening All

Could you please help. I have created a macro with the following code:

Range("H2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=RC[4]/RC[-1]"
Selection.AutoFill Destination:=Range("H2:H4893")
Range("H2:H4893").Select

This code should have done a simple formula of =L2/G2 and then copied the formula using autofill. It works on the first cell, but then just copies that cells result down the column.

The L and G columns are copied from another sheet, Will that make a difference?

Regards

Jupops
 
The coding works fine, I just copied from your post into a module and it worked.

Do you have calculation on, after the coding runs, this might be the reason.

in the cell H3, do you have a formula? if so calcualtion is off.
USe the command after your post of
Application.Calculation = xlCalculationAutomatic
this will make sure calcualtion is automatic.

Here also is a simplified version of your code.

Range("H2").FormulaR1C1 = "=RC[4]/RC[-1]"
Selection.AutoFill Destination:=Range("H2:H4893")
Application.Calculation = xlCalculationAutomatic

this works just as well.

Hope it helps.





Thanks Rob.[yoda]
 
Thanks Rob

This was just perfect

Thank You

Jupops
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top