Inspect a range cell by cell

Alejandraoskan

Board Regular
Joined
Oct 16, 2002
Messages
92
Hi,

I have the following issue, I need to loop throught a range and get 2 things done:

1)the value of the cell
2)select the cell (so I know where I am at all times)

this is my first idea

for cell in range("a1:a50")
cell.select
msgbox cell.value
next

but it doesn'work the selection never moves

this maybe an issue with msgbox and modal behavior but can't not find a solution

appreciate any help
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
You're missing the Each:

Dim c as Range
For Each c in Range...

It's also not a good ideal to use Cell as a variable, nor is it necessary to select objects in order to work with them. You could just as easily use:

MsgBox "Cell " & c.Address & "Value =" & c.Value

HTH,
 
Upvote 0
yes that works well,

but sometimes is usefull to be able to select the cell to follow/trace a loop so I guess there is no easy way around , the msgbox blocking the UI refresh that will enable us to see how each cell gets selected

Thanks,
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top