Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default For Each Loop w/ a range

Sub AB()
For Each cell In Range("A1, B3, C5")
Debug.Print cell.Address
Next cell
End Sub

produces:
$A$1
$B$3
$C$5

so your problem isn't in looping through the cells and there is no sense to
going to something more convoluted to achieve what is already being
achieved.

--
Regards,
Tom Ogilvy


"xlcharlie" wrote in message
...
The basics of my code a

For each cell in Range("A1, B3, C5")
If cell.value=x Then
'change to this value
Else
'change to another value
End If
Next Cell

But this only seems to work on the first cell. What I am trying to do is
iterate through small group of cells (not necessarily in an array) to see
whether the date in each is a good business day. If not, the code

replaces
the date with a string variable. Can you not use a For Each Loop for

this?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop in range Aksel Børve Excel Programming 3 March 9th 05 02:30 PM
Loop in a Range aksel børve Excel Programming 2 March 8th 05 06:40 PM
Loop through Range and Cut and Paste Kevin L Excel Programming 2 February 16th 05 06:19 PM
Loop through a range Fred[_21_] Excel Programming 6 October 22nd 04 10:45 PM
Increasing a range in a loop ric Excel Programming 4 April 26th 04 07:59 PM


All times are GMT +1. The time now is 10:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"