How can I count the number of used columns in a specific row? The below code doesn't work.
Please Login or Register to view this content.
How can I count the number of used columns in a specific row? The below code doesn't work.
Please Login or Register to view this content.
Last edited by EnergyEngineer; 09-28-2007 at 03:26 PM.
This will found last used column for activecell
assumes it's not xl 2007Please Login or Register to view this content.
VBA Noob
_________________________________________
Credo Elvem ipsum etian vivere
_________________________________________
A message for cross posters
Please remember to wrap code.
Forum Rules
Please add to your signature if you found this link helpful. Excel links !!!
I used this and it worked. Thanks!
Please Login or Register to view this content.
Does it work with the speech marks around 71?Originally Posted by EnergyEngineer
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
Glad it helped.
Just a tip. You can use the VBA recorder to give you
Where selection is a cell in the last column then mod as requiredPlease Login or Register to view this content.
VBA Noob
Yah I noticed that and I just fixed it. It worked but I took it out since it was extra.
Thanks,
~RUTH~
Thanks but I needed the count for a loop.
~RUTH~
I meant use the recorder to give you the direction then tweak. So change selection with your ref and last column
hope that makes sense
VBA Noob
Yah I got it. Thanks! The macro recorder is pretty nifty. Sometimes I like to figure it out the hard way.
~RUTH~
Does it work if there's a value in Col_256?Originally Posted by EnergyEngineer
Try something like this:
Does that help?Please Login or Register to view this content.
Last edited by Ron Coderre; 09-28-2007 at 04:23 PM.
Hard way being the forum
VBA Noob
No I don't think I will ever have something in column 256. Thanks for the debug thought.
~RUTH~
If you select cell say A256 and you press Ctrl + left arrow it will take you to either A1 if no cells filled in or any cell that has a value.
When you record this action you get
Then change selection as you did toPlease Login or Register to view this content.
Your row and last column of spreadsheetPlease Login or Register to view this content.
by changing
toPlease Login or Register to view this content.
you return the column numberPlease Login or Register to view this content.
HTH
VBA Noob
Yah yah I understood what you were saying. Thanks for the detailed explanation.
~RUTH~
Good to hear.
However I thought I should explain as your comment below seem to me that you didn't understand
VBA NoobOriginally Posted by EnergyEngineer
That was in response to Ron and his thought if there was something in cell 256.
~RUTH~
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks