Using Data in a range in order

Bill_Biggs

Well-known Member
Joined
Feb 6, 2007
Messages
1,216
I have a range of cells with data in each cell. The range is from C3 to S23. The data is coordinates to cells on another sheet. I need to create a macro that will go to the range, pick out the first coordinate, execute a function, then go back and select the next coordinate, execute a function and so on through all 357 coordinates. Can anyone show me a small macro that will do that? Something like:

Range(C3, C4, C5, C6... S23)
Pick first coordinate,
Excute function at coordinate
Go back to range and pick next coordinate
Excute function at coordinate...
At end of Range, exit sub

I have the execute portion of the macro down.

Thanks in advance,
 
Last edited:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
are you saying contents of cells in range are text references to other cells -- eg "Sheet1!A1" ?

If you are...you mean something like the below ?

Code:
Dim cell as Range
Dim rng as Range
Dim ws as String: ws = activesheet.name
Set rng = Sheets("x").Range("C3:S23")
For Each cell in range
Range(cell.value).Select
...
Sheets(ws).Select 'not strictly required
Next cell
 
Upvote 0
No, even less healthy, that's me lighting a ciggie... but that was way back then and this is now and I've given it up...I am a man with no vices (that I can talk about!)

Let me know how you get on and post back with any problems...
 
Upvote 0
This is Excel 2000 (we are updating to 2003 in a few weeks) and it doesn't like the line:

For Each cell In Range

Saying that Range is not optional. Any suggestions?
 
Upvote 0
sorry, typo...change to

Code:
For Each cell In rng

I'd better sign off before I ruin anything else... :(
 
Upvote 0

Forum statistics

Threads
1,213,564
Messages
6,114,334
Members
448,567
Latest member
Kuldeep90

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