VBA syntax to write formula to sheet

BDrew

Board Regular
Joined
Jun 8, 2008
Messages
79
I am attempting to add this formula to the Table of Contents: sheetname("TOC") in column D for a looping routine.
=MATCH("Ω",INDIRECT("'"&TOC!B4&"'!A:A"),1)

I must change "Ω" to ChrW(937) and TOC!B4 to TOC!B & NewRow so that I can increment NewRow=NewRow+1

TOC.Range("D" & NewRow).Formula = "=MATCH(" & ChrW(937) & ",INDIRECT(" & "" &"'TOC!B" & NewRow & "'!A:A"),1)"

the problem starts at INDIRECT(" which excel VBA considers an ending quote and attempting to put more quotes around that isolates the next problem at
'TOC!B which is considered as a note and not part of the formula.

Any assistance would be appreciated.

Brendan
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Got it thanks

"=MATCH(" & ChrW(937) & ",INDIRECT( &""" & "'" & "TOC!B" & NewRow & "'!A:A" & "),1)"

Brendan
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,580
Members
449,039
Latest member
Arbind kumar

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