G
Guest
I have a formula in cell C2. I want to create a macro in VBA to fill down
that formula into cells C3:C100. How would I write that code?
that formula into cells C3:C100. How would I write that code?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Secret Squirrel said:Ok last question... I've compiled this macro from a couple of my posts
tonight but when I fire the macro it doesn't do the filldown unless I fire it
twice in a row. Any idea why that might be? The "RefreshAll" is to refresh my
query I have in my workbook.
Public Sub CopyTwo()
ActiveWorkbook.RefreshAll
Worksheets("Sheet1").Range("C2:C100").FillDown
Worksheets("Sheet1").Range("A1:C100").Copy
With Worksheets("Sheet2")
.Range("A1").PasteSpecial _
Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.Goto .Range("A1"), Scroll:=True
End With
With Worksheets("Sheet1")
Application.Goto .Range("A1"), Scroll:=True
End With
Application.CutCopyMode = False
End Sub
Secret said:Ok last question... I've compiled this macro from a couple of my posts
tonight but when I fire the macro it doesn't do the filldown unless I fire it
twice in a row. Any idea why that might be? The "RefreshAll" is to refresh my
query I have in my workbook.
Public Sub CopyTwo()
ActiveWorkbook.RefreshAll
Worksheets("Sheet1").Range("C2:C100").FillDown
Worksheets("Sheet1").Range("A1:C100").Copy
With Worksheets("Sheet2")
.Range("A1").PasteSpecial _
Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.Goto .Range("A1"), Scroll:=True
End With
With Worksheets("Sheet1")
Application.Goto .Range("A1"), Scroll:=True
End With
Application.CutCopyMode = False
End Sub
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.