how to use tab[column header] in VBA

Tahitipit

New Member
Joined
Feb 3, 2015
Messages
5
Hi,

I have the following formula in VBA which works fine
Worksheets("TRANSPORT").Range("ZONEFRET[Amount in local Currency]").Formula = "=IF(OR(B17="""",C17="""",D17="""",E17="""",F17=""""),"""",MIN(H17,MAX(C17*F17,G17)))"

But instead of using cell references I would lile to use tab[column header]

Here the fomula in excel format
=IF(OR(ZONEFRET[@Description]="",ZONEFRET[@QTY]="",ZONEFRET[@Unit]="",ZONEFRET[@Currency]="",ZONEFRET[@[Unite Price]]=""),"";MIN(ZONEFRET[@Max],MAX(ZONEFRET[@QTY]*ZONEFRET[@[Unite Price]],ZONEFRET[@Min])))

The syntaxe seems to be differente in VBA , how can I write that formula in VBA ?

Thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
The macro recorder will give you the correct syntax.

Select any cell with the formula.
Start the macro recorder.
Press F2.
Press Enter.
Stop the macro recorder.

It should be as simple as doubling up on the double quotes, the same as you would with a regular formula
"=IF(OR(ZONEFRET[@Description]="""",ZONEFRET[@QTY]="""",ZONEFRET[@Unit]="""",ZONEFRET[@Currency]="""",ZONEFRET[@[Unite Price]]=""""),"""";MIN(ZONEFRET[@Max],MAX(ZONEFRET[@QTY]*ZONEFRET[@[Unite Price]],ZONEFRET[@Min])))"

But the single semi-colon in the formula is making me doubt that the formula syntax is valid.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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