I am trying to write a pretty big macro to pull data from one sheet and parse and transform it into different sheets.
Going pretty well in everything else. However, I am stuck with 1 part.
I have multiline text in a cell (11 lines in this example, but could be dynamic)
The sample text I am trying to build my code on is below (the lines are separated by a space and Alt+Enter after the last character in each line):
Flat where a figure is quoted but theshold based on the following lanes
IL STD $5.00 above $75.00 USD
SG STD $11 above SGD400
TR STD $3 above €30 EUR
AU EXP $2 for value>AUD 1000
IL EXP $2 for value>USD 75
JP EXP $2 for value>USD 65
NZ EXP $2 for value>NZD 400
PH EXP $2 for value>USD 165
SG EXP $2 for value>SGD 400
TW EXP $2 for value>TWD 2000
My requirement is to parse this text into a table as below:
I started with the logic that I will count the number of line breaks/carriage returns and then create arrays using loop for the number of line count.
But I haven't been able to achieve this.
I have tried the below variation of codes to get no. of lines but keep getting 0 for the output.
Sub tresholds()
Dim strTest As String
Dim NewLines As Long
strTest = ThisWorkbook.Sheets("Rate Card").Range("D10").Text
NewLines = UBound(Split(strTest, Chr(32) & vbCrLf))
'NewLines = UBound(Split(strTest, " " & vbCrLf))
'NewLines = UBound(Split(strTest, vbCrLf))
'NewLines = UBound(Split(strTest, vbLf))
'NewLines = UBound(Split(strTest, Chr(32) & vbLf))
Debug.Print NewLines
End Sub
Also, I'm not too good at regex. And there are multiple patterns in the string. Some lines have currency symbols and others dont. Some have 'value above' and others have value >. Couldn't figure out how to account for these variations.
Would really be grateful if you guys could help.