Forum Home
Press F1
 
Thread ID: 91849 2008-07-21 00:01:00 Damn Excel! ubergeek85 (131) Press F1
Post ID Timestamp Content User
690615 2008-07-21 00:01:00 Hi guys. I've got a whopper of a problem (well, to me). I've recorded a macro in excel, all it does is add some columns, write to cells in the new columns, drag it down, then hide the columns it just made. The problem is, while recording it, I wrote a placeholder to the cells, and just edited the macro later with the formula I wanted to put in (there is no way I could remember the formula). But, the formula has " marks in it (the same used to define the start and end of the statement). Can anyone help? Searching the net hasn't given me much help. Thanks.


ActiveCell.FormulaR1C1 = "=IF(A1="1?:*",VALUE(LEFT(A1,5)&" "&RIGHT(A1,2)),VALUE(LEFT(A1,4)&" "&RIGHT(A1,2)))"
ubergeek85 (131)
690616 2008-07-21 01:16:00 Try using two consecutive double quotes around your text. E.g.


ActiveCell.FormulaR1C1 = "=IF(A1=""1?:*"",VALUE(LEFT(A1,5)&"" ""&RIGHT(A1,2)),VALUE(LEFT(A1,4)&"" ""&RIGHT(A1,2)))"
odyssey (4613)
690617 2008-07-21 01:27:00 Hmm, it sort of works. Now the macro executes correctly, but this gets written to the cell:

=IF('A1'="1?:*",VALUE(LEFT('A1',5)&" "&RIGHT('A1',2)),VALUE(LEFT('A1',4)&" "&RIGHT('A1',2)))

And excel just gives #NAME? indicating that the ' (single quotation marks) are interfering. Thanks anyway.
ubergeek85 (131)
1