vba help - R1C1 formula not working

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
976
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

Need help in below Formual , I am unable to add 15 days to existing date Column.
getting errror.


VBA Code:
Delivery_Date  = 5
DateAdd = 15

'Attempted code
With wsMaster
         With .Range(.Cells(3, 6), .Cells(lr_master, 6))
            .FormulaR1C1 = "=RC " & Delivery_Date & "" + DateAdd
         End With
End With


Recorded
Range("F3").Select
ActiveCell.FormulaR1C1 = "=RC[-1]+15"


Thanks
mg
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
It should be:

Code:
.FormulaR1C1 = "=RC" & Delivery_Date & "+" & DateAdd
 
Upvote 0
How about
VBA Code:
.FormulaR1C1 = "=RC" & Delivery_Date & "+" & DateAdd
I would advise against using DateAdd as a variable name as it's a VBA keyword.
 
Upvote 0
Hi Rory and Fluff,

Thanks for your help it worked. I will change dateAdd variable.
thanks for highlighting it. (y) ?



Thanks
mg
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,537
Messages
6,125,393
Members
449,222
Latest member
taner zz

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