80Brindley
New Member
- Joined
- Aug 17, 2015
- Messages
- 5
I have created a formula by concatenating a number of cells with text.
Example:
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(""=VLOOKUP(X3,'["",R1C24,"".csv]"",R1C24,""'!$C$2:$BA$13957,"",R[-2]C,"",FALSE)"")"
Output would be:
=VLOOKUP(X3,'[ForMazImages23-7-15-Import.csv]ForMazImages23-7-15-Import'!$C$2:$BA$13957,2,FALSE)
I can manually click on the formula Bar for each cell (as if to edit it) then press Tab and the Concatenated text will then convert into the formula and calculate the result.
I am trying to replicate this in a VBA macro however i my macro moves to the next cell without activating/editing the cell to convert the contents to a formula.
I have tried:
Do While Not IsEmpty(ActiveCell.Offset(0, 1).Range("A1"))
ActiveCell.Offset(0, 1).Activate
Loop
I have also tried:
Do While Not IsEmpty(ActiveCell.Offset(0, 1).Range("A1"))
ActiveCell.Offset(0, 1).Activate
Application.SendKeys("F2")
Loop
However in both cases, the macro just moves to the next cell without converting the text to a formula.
Any ideas? I'm not sure if i should mention that i'm using Excel for Mac.
Example:
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(""=VLOOKUP(X3,'["",R1C24,"".csv]"",R1C24,""'!$C$2:$BA$13957,"",R[-2]C,"",FALSE)"")"
Output would be:
=VLOOKUP(X3,'[ForMazImages23-7-15-Import.csv]ForMazImages23-7-15-Import'!$C$2:$BA$13957,2,FALSE)
I can manually click on the formula Bar for each cell (as if to edit it) then press Tab and the Concatenated text will then convert into the formula and calculate the result.
I am trying to replicate this in a VBA macro however i my macro moves to the next cell without activating/editing the cell to convert the contents to a formula.
I have tried:
Do While Not IsEmpty(ActiveCell.Offset(0, 1).Range("A1"))
ActiveCell.Offset(0, 1).Activate
Loop
I have also tried:
Do While Not IsEmpty(ActiveCell.Offset(0, 1).Range("A1"))
ActiveCell.Offset(0, 1).Activate
Application.SendKeys("F2")
Loop
However in both cases, the macro just moves to the next cell without converting the text to a formula.
Any ideas? I'm not sure if i should mention that i'm using Excel for Mac.