strSplit = Split(Split(strAddressString,“,”)(2)," “)(1)
–=–
You can use the text to column in the same manner
You need to first use , as delimiter and you will get the city in second column
and then use space (” ") as delimiter for third column and you will get rest of the two values
Split the string by “,” into an array of three. The address is the first array element, City is second, the 3rd is state and zip, so split by " " or substring first 2 characters for state, the remaining for zip code.
Thank you all for your code and examples. I’ve been able to cobble together a solution that is working well, but with one small glitch I can’t seem to figure out.
I’m storing what’s shown in TempAddy in the strAddyTempString variable
I am then splitting that variable into multiple variables…
A non-elegant workaround way to solve would be to hit F2 > Back > Enter on the cell after the Write Cell “strAddress” activity, but I can’t seem to get that to work with the various key trigger/hot key activities.
I’d rather use Regex with groups like @Yoichi did: you don’t have to deal with unwanted chars and you keep your code more readable. Otherwise, try to use Trim like
That didn’t work at all. The code was incomplete. Do I need to add something at the end of Trim?
Per your recommendation, I figured out how to use the cleaner @Yoichi method in the image below, I still get the same result in the excel file “Address” field. There is a carriage return/new line added when the value is written. I am looking at the “Write Cell” command and there’s nothing in there that’s set to add an additional new line.
Back to my earlier comment, which activity would I need to use within “Excel For Each Row” to be able to perform key triggers? If I can just F2 > Back > Enter, then I have a workaround.