• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA CODE USE OF TAB[column header]

Tahitipit

New Member
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
 

Marc L

Excel Ninja
Salut !​
In VBA there are two syntaxes :​
  • the inner Excel english version whatever if the Excel version is local (not english) via the Formula property;
  • the local Excel version if the version is not english (español, french, german, italian, whatever …) via the FormulaLocal property.
As here your formula is in english (better for an international environment with different Excel language versions)​
so it's the Formula property but the syntax does not change, still lexactly the same !​
Except if the formula contains double quotes you just must double each one …​
 
Top