Hello all,
I'm having an issue getting an IF then statement to work within VBA. I'm trying to have my spreadsheet format a text to columns if A2 is blank. (meaning if it hasn't been text to columns already)
I've tried a number of different formulas. It's not skipping if A2 has data and redoing the text to columns.
Here's the formula I've been trying. I've even tried the IsEmpty formula with no luck.
If B2 = "" Then
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(10, 1), Array(28, 1), Array(47, 1), Array(56, 1), _
Array(76, 1), Array(104, 1)), TrailingMinusNumbers:=True
End If
Any help would be greatly appreciated.
I'm having an issue getting an IF then statement to work within VBA. I'm trying to have my spreadsheet format a text to columns if A2 is blank. (meaning if it hasn't been text to columns already)
I've tried a number of different formulas. It's not skipping if A2 has data and redoing the text to columns.
Here's the formula I've been trying. I've even tried the IsEmpty formula with no luck.
If B2 = "" Then
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(10, 1), Array(28, 1), Array(47, 1), Array(56, 1), _
Array(76, 1), Array(104, 1)), TrailingMinusNumbers:=True
End If
Any help would be greatly appreciated.