Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quotation Marks in Excel Macro 1

Status
Not open for further replies.

SallyPDS

Technical User
Jun 22, 2006
2
GB
I am trying to write a macro to construct the formula
=if(datacell="N",value1,value2)
into each cell in a column as it moves down.

My macro line looks like:
Activecell.Offset(0,20)="=if(T"& Activecell.Row & "="N",v1,v2)"

Because the formula to be inserted is within Quotation marks, it is getting confused by the "N" portion.

Can anyone tell me how to indicate that the "N" is part of the formula (i.e. literal) and not part of the macro code?
 
Activecell.Offset(0,20)="=if(T"& Activecell.Row & "="[!]"[/!]N[!]"[/!]",v1,v2)"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top