Hi,
I'm trying to write a script that will check a column of cells for a carriage return and then perform an operation and paste that new values into the cells in the next column. Currently I'm just working on doing the simplest version of this with trying it or one cell. I'm trying to get the variable "reformatB" to get assigned a new value based on the calculation below and then display it in a message box. I've tried with and without quotes and many other things but the message box just displays the actual string inside the quote marks rather than evaluating what's inside the quote marks. What am I do wrong? Thanks in Advance.
Sub test()
v = Range("B1").Value
Dim reformatB As Variant
If InStr(1, v, Chr(10)) > 0 Or InStr(1, v, Chr(13)) > 0 Then
reformatB = "=(LEFT(B1, Find(CHAR(10), B1) - 1)),B1))"
MsgBox reformatB
Else
MsgBox "no return"
End If
I also tried reformatB = "=EVAL(LEFT(B1, Find(CHAR(10), B1) - 1)),B1))" and that did not work either. Thx.
Bookmarks