Insert Formula Running Too Long??

pztexas12

New Member
Joined
Mar 30, 2012
Messages
26
Hi,

I am very new to VBA. I've written the following code to insert a formula into a specific column as follows:

Sub L_InsertFormula()
Range("C2:C10000").Formula = _
"=IF(D2=0,"""",ROUND(D2, 4)*100) "
End Sub

The problem is the formula runs too long and causes issues with mail merge. I really only need the formula to run as long as there are values in the column it references which is column D.

Thank You for any help! :)
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi

Assuming your data always starts in D2 then the usual approach is:

Rich (BB code):
Sub L_InsertFormula()
Range("C2:C" & Cells(Rows.Count,"D").End(xlUp).Row).Formula = _
"=IF(D2=0,"""",ROUND(D2, 4)*100) "
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,398
Members
449,155
Latest member
ravioli44

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