R
Ron Rosenfeld
At the risk of sounding pedantic, I think your first statement in the For
Each loop should more properly be this...
str = c.Value
But instead of doing this intermediate step of using a String variable, as
above, to feed to the Execute property of your 're' object, you could have
eliminated using this variable and done so directly (the way you did with
the c.Text value originally) like this...
Set mc = re.Execute(c.Value)
...that would have worked too, correct? Or will Execute only accept a typed
String entity in order for it to work?
Rick
Actually,
set mc = re.execute(c)
would also work just fine.
The "str" construct was left over from my testing to trying to figure out
exactly where the limitation was, and I didn't clean things up afterwards.
So far as c vs c.value, I believe they are equivalent, as I believe the value
property is the default for the range property, although I would generally use
c.value for clarity. As with the str construct, it was a leftover from my
testing to figure out where the hangup was.
I believe, although I have not found it documented (yet), that the TEXT
property of the range function returns what is actually displayed in a cell,
INCLUDING the limitation of 1024 characters that can be displayed. (I had not
appreciated that 1024 limitation up until now).
I had been in the habit of using the text property for regex stuff so as to
preserve the formatting of numbers, which would be important in designing a
regex. Obviously, for potentially long strings, this is inappropriate.
By the way, in your routine, you could eliminate your IF line. (I know you
like more compact routines )
If C Mod Columns.Count = 0 And C > 0 Then R = R + 1
Range("A1").Offset(R, C Mod Columns.Count).Value = Values(C)
to:
Range("A1").Offset(Int(C / Columns.Count), _
C Mod Columns.Count).Value = Values(C)
Best,
--ron