View Full Version : Excel help ... please
Silver Owl
01-31-2005, 05:14 PM
How do you assign a text string to a cell that contains quotation marks from a macro.
Worksheets("Worksheet1").Cells(2, 1).Value = "=IF(Worksheet2!A3="","",Worksheet2!A3)"
I am trying to get the cell from "Worksheet1" to have the same value as cell A3 from "Worksheet2" and if the cell is blank, then I want the "Worksheet1" cell to also be blank.
Just a simple cell=cell is giving me a "0" in the Worksheet1 cell if Worksheet2 blank.
I know that there is probably an easy solution, but I am lost. :confused:
gstelmack
01-31-2005, 09:28 PM
Sounds like the cell has a "Number" format instead of a "General" or "Text" format.
If you want a "Number" format, can't you just set up the format string so "0" is blank?
If you want a "Number" format and non-blank zeroes, you may be screwed.
Rizon
01-31-2005, 09:45 PM
Is this what you want?
=IF(Sheet2!A3>"",Sheet2!A3, "")
Silver Owl
02-01-2005, 04:12 PM
Sounds like the cell has a "Number" format instead of a "General" or "Text" format.
If you want a "Number" format, can't you just set up the format string so "0" is blank?
If you want a "Number" format and non-blank zeroes, you may be screwed.
Thanks gstelmack,
It seems that when i do a "cell1 = cell2", the result is a "0" in cell1 if cell2 is blank. I've tried different formats and I get the same result.
Silver Owl
02-01-2005, 04:19 PM
Is this what you want?
=IF(Sheet2!A3>"",Sheet2!A3, "")
Thanks Rizon,
I am trying to assign this formula from a macro and the "" (quotation marks) are throwing everything off. I need to know how to include "" (quotation marks) within a quote.
Worksheets("Worksheet1").Cells(2, 1).Value = "=IF(Worksheet2!A3="","",Worksheet2!A3)"
lurker
02-01-2005, 04:25 PM
I think this would work:
Worksheets("Worksheet1").Cells(2, 1).Value = "=IF(Worksheet2!A3="""","""",Worksheet2!A3)"
Just need 4 quotation marks on either side of the comma instead of 2.
Silver Owl
02-01-2005, 04:48 PM
Lurker,
Thank you very much. That did it ! I figured that it was something simple.
lurker
02-01-2005, 04:55 PM
Glad it worked. Anything to put off doing my own Excel work.
vBulletin v3.6.0, Copyright ©2000-2026, Jelsoft Enterprises Ltd.