How to select cells randomly in Excel

Hi there.

I want it to select a new cell in a column ramdomly every time. How can this be done properly? For instance B1, next time B7 etc. etc.

Andreas

@Andreas2107

Use F5 Command via Send Hot key activity. You ll get a Go To window where you can enter any random cells

image

Hi.

I need to automatically read a cell randomly and save the content in variable. As I read your solution, it looks like I have to select manually?

Andreas

oh then you can use Read cell activity to fetch the required cells.

Or you need to choose a cell randomly by robot ?

I’m using read cell now to target one specific cell (C1). In my excel sheet i have a range of values in column C from C1 to C9. I’m running a loop where the robot goes through a sequence for each loop.

My issue is that i want to read a random cell i column C for each loop. So i need to generate a random value for each loop to select a cell in column C. Just like if i generate a random number - it just needs to be C+the random number. If that makes sense. :slight_smile:

@Andreas2107

Use one Assign Activity
Declare an integer variable inta

inta = System.Random.Next(1,Max Value)

Replace the maximum value up to which you have to generate the random number
inta will contain the random integer in between the values you have mentioned

For Example
System.Random.Next(1,8) will return a random number in between 1 and 8

Next You can Mention C+inta.ToString in Read Cell Activity.

Regards,
Mahesh

1 Like

Super. That sounds right. I will test it :slight_smile: