This will do the same thing and is much more compact...
strLastColumn = Split(ActiveCell.Address(True, False), "$")(0)
Rick
> You could do this...
>
[quoted text clipped - 20 lines]
>>
>> Rob
On Wed, 14 May 2008 04:02:51 -0400, "Rick Rothstein \(MVP - VB\)"
<rick.newsNO.SPAM@NO.SPAMverizon.net> wrote:
>strLastColumn = Split(ActiveCell.Address(True, False), "$")(0)
You can omit the True and make it even more "compact" :-))
Split(ActiveCell.Address(, False), "$")(0)
or even:
Split(ActiveCell.Address(, 0), "$")(0)
--ron
Rick Rothstein (MVP - VB) - 14 May 2008 20:59 GMT
Yeah, I know... but there are certain situations where I shy away from using
default values when posting code to newsgroups where readers may not be
familiar with some of the one-liner constructions I come up with... commas
next to opening parentheses is one of them.... too many people tend to type
code from postings rather than copy/paste it (which I have **never** been
able to understand) and the isolated comma next to an opening parentheses
(being an unusual character combination) seems too easy to over look to me.
Maybe I am being too overprotecting? And, of course, I could have compacted
my own response like so...
Split(ActiveCell.Address(1, 0), "$")(0)
if I had really thought about it (yes, plus 1 will work in place of True
even though the value of True is actually -1).<g>
Rick
> On Wed, 14 May 2008 04:02:51 -0400, "Rick Rothstein \(MVP - VB\)"
> <rick.newsNO.SPAM@NO.SPAMverizon.net> wrote:
[quoted text clipped - 10 lines]
>
> --ron
Ron Rosenfeld - 15 May 2008 01:41 GMT
On Wed, 14 May 2008 15:59:48 -0400, "Rick Rothstein \(MVP - VB\)"
<rick.newsNO.SPAM@NO.SPAMverizon.net> wrote:
>if I had really thought about it (yes, plus 1 will work in place of True
>even though the value of True is actually -1).<g>
Yup -- any non-zero converts to TRUE.
--ron
Rick Rothstein (MVP - VB) - 15 May 2008 01:59 GMT
>>if I had really thought about it (yes, plus 1 will work in place of True
>>even though the value of True is actually -1).<g>
>
> Yup -- any non-zero converts to TRUE.
In past postings (over in the compiled VB newsgroups), I explained it this
way... for evaluation of logical expressions, VB defines False to be zero
and True to be Not False.
Rick