Need VBA Help – How to Insert an Excel Function into B2 of an 8 column table with VBA

wddogger

New Member
Joined
Jan 19, 2017
Messages
5
Need VBA Help – How to Insert an Excel Function into B2 of an 8 column table with VBA

The purpose of the formula (function) to be inserted into B2 of Table1 is twofold; convert Date value in (Table1 / cell A2) to text and concatenate to it the Description value (Table1 / cell C2) . The formula is to be placed in Table1 / cell B2. The vba statements I am trying to use are as follows:
Sub Insert_Formula()
Range.formula = “=CONCATENATE(TEXT([@Date],"mm/dd/yy"),"_",{@Description])”
End Sub

The above statements cause a Compile Error – Expected End of Statement with mm highlighted.

If I convert Table1 to a range and insert the formula =CONCATENATE(TEXT(A2,"mm/dd/yy"),"_",C2) into cell B2 of the worksheet, the formula performs the date to text conversion & concatenation correctly.

I presume I am using incorrectly structured references for the range.formula = statement but have not been able to figure it out. Any help would be greatly appreciated.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Did you try
Code:
Range("B2").Formula = “=CONCATENATE(TEXT([@Date],"mm/dd/yy"),"_",{@Description])”
 
Upvote 0

Forum statistics

Threads
1,223,706
Messages
6,173,998
Members
452,542
Latest member
Bricklin

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