Irazor
asked on
excel vba non contiguous cells count
Hi I want to be able to count the non contiguous cells in a column so I can use those figures to run a random number against those cells. An example of the data is attached.
Project.xlsm. I'm assuming that it's uploaded any code that I've been messing with.
Basically you'll see some horse race information in rows and columns so I would like to use something like
Any clues/help/info would be great as I'm taking to long to solve this in VBA.
Kind regards
Dave
PS I hope this makes sense.
Project.xlsm. I'm assuming that it's uploaded any code that I've been messing with.
Basically you'll see some horse race information in rows and columns so I would like to use something like
int(Randbetwee(1, ??)
with each horse race.Any clues/help/info would be great as I'm taking to long to solve this in VBA.
Kind regards
Dave
PS I hope this makes sense.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Bruce, welcome to the Excel zone.
Thomas
Thomas
ASKER
Hi to you both and thanks for taking an interest. I apologize if I wasn't clear enough with description.
However, Thomas has managed to see through the fog and pretty much get done what I asked for with
his VBA routine.
Thanks to you both.
~ Dave.
However, Thomas has managed to see through the fog and pretty much get done what I asked for with
his VBA routine.
Thanks to you both.
~ Dave.
Glad to help.
If you want the entire row highlighted, use instead
Thomas
If you want the entire row highlighted, use instead
rgRace.Rows(Application.WorksheetFunction.RandBetween(2, rgRace.Rows.Count)).entirerow.Interior.ColorIndex = 5
Thomas
I've had a look at your code, and i didn't really get the connection between your description and the code.
I'm guessing that you would like to pick 1 from n (or perhaps each of 1-n) randomly, but since the number participants in each race could vary, you are not sure what 'n'
Is that about it?
You can more or less do that without VBA, except you might get duplicates.
In cell n9, enter this formula and fill down.
IF(K9<> "",RANDBETWEEN(1,MATCH("*"
Please explain what you want to do and we can refine it a bit.
Bruce
Bruce