I am attempting to do a Text-to-Column conversion using VBA, and am getting a run-time 1004 (No data selected to parse) if the column is completely empty.
This, of course, makes sense.
However, how do I get past this?
The source data used is formatted as text and the formatting is beyond my control - however, I need to convert the data to a number in order to perform any meaningful calculations.
I have numerous columns in the worksheet that I need to perform this conversion on and each of these columns may, or may not, contain data on a given day.
So I need to perform the conversion, if applicable, on a given column then move to the next and repeat as necessary.
The code I am currently utilizing is below.
Thanks in advance!
This, of course, makes sense.
However, how do I get past this?
The source data used is formatted as text and the formatting is beyond my control - however, I need to convert the data to a number in order to perform any meaningful calculations.
I have numerous columns in the worksheet that I need to perform this conversion on and each of these columns may, or may not, contain data on a given day.
So I need to perform the conversion, if applicable, on a given column then move to the next and repeat as necessary.
The code I am currently utilizing is below.
Thanks in advance!
Code:
'Column / RANGE 1.
'CONDITIONAL FILL.
If Last_Row_ColA > 3 Then
Range("AA3:AA" & Last_Row_ColA).Select
Selection.TextToColumns Destination:=Range("AA3"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Else
Range("AA3").Select
Selection.TextToColumns Destination:=Range("AA3"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
End If