Fill formula down based on data in another worksheet VBA

cmschmitz24

Board Regular
Joined
Jan 27, 2017
Messages
150
I need help modifying a VBA code to fill down a formula based on data in another worksheet.

Code:
Worksheets(2).Name = "Data"
EndRow = Sheet1.Range("E" & Rows.Count).End(xlUp).Row
Range("A1").Formula = "=TEXT(Delinquency!R[1]C[6],""00000000"")"
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:A" & EndRow), Type:=xlFillDefault

I need to copy the formula in cell A1 down on the "Data" sheet based on values in column E from the "Delinquency" sheet, starting with E2.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi there,

Forgive me if I am misunderstanding your question, but I believe you could just say:

Code:
Range("A1:A" & EndRow).formula = Range("A1").formula

Also no need for the 'Select' line that way, which is always a bonus!

Cheers
JB
 
Upvote 0
I'm still having issues, or my formula isn't working -

I need to have the formula in cell A1 on the 2nd worksheet filled down based on the data from the 1st worksheet in column E, starting with cell E2.
 
Upvote 0
Try:
Code:
EndRow = Sheet1.Range("E" & Rows.Count).End(xlUp).Row
Sheets("Data").Range("A1:A" & EndRow).Formula = "=TEXT(Delinquency!R[1]C[6],""00000000"")"
No need to fill down.
 
Upvote 0
Try:
Code:
EndRow = Sheet1.Range("E" & Rows.Count).End(xlUp).Row
Sheets("Data").Range("A1:A" & EndRow).Formula = "=TEXT(Delinquency!R[1]C[6],""00000000"")"
No need to fill down.


The 2nd worksheet does not have anything on it, it's blank, no headers, no text, etc. The code above will pull the right information via the formula for cell A1 on the 2nd worksheet, but it does not pull the formula for the rest of the data in column G on the first worksheet to the 2nd worksheet.
This is why I would copy the formula down the column.
 
Upvote 0
The 2nd worksheet does not have anything on it, it's blank, no headers, no text, etc. The code above will pull the right information via the formula for cell A1 on the 2nd worksheet, but it does not pull the formula for the rest of the data in column G on the first worksheet to the 2nd worksheet.
This is why I would copy the formula down the column.

Is that after testing? and why column G as it was column E you stated earlier?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,108
Members
452,544
Latest member
aush

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top