VBA concatenate

  • Thread starter Thread starter sb1222
  • Start date Start date
S

sb1222

Hi,
I'm familiar with concatenating (using "&") in excel. When trying to use
it in VBA this works:

Dim text As String
Dim front As String
Dim middle As String
Dim back As String
Dim formula As Variant

text = Mid(ActiveCell.formula, 2)

front = "=IF(ISERROR(" & text
middle = "),'N/A'," & text
back = ")"


But I can't combine the three strings together. This does NOT work:

formula = front & middle & back


I have a compiling error that says expecting end of statement.
Any thoughts would be helpful.


Thanks

** Posted via: http://www.ozgrid.com
Excel Templates, Training, Add-ins & Business Software Galore!
Free Excel Forum http://www.ozgrid.com/forum ***
 
Back
Top