#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default loop

Hi

I know you can do a loop for each worksheet in the
workbook, but can you do one for each cell within a range
eg C4:H9
If so, how ?

ty :)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default loop

Sub Chng()
For Each Cel In Range("C4:H9")
Cel.Value = Cel.Value * 2
Next Cel
End Sub

or

Sub Chng()
Set Rng = Range("C4:H9")
For Each Cel In Rng
Cel.Value = Cel.Value * 2
Next Cel
End Sub

etc

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"LiSa" wrote in message
...
Hi

I know you can do a loop for each worksheet in the
workbook, but can you do one for each cell within a range
eg C4:H9
If so, how ?

ty :)



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.703 / Virus Database: 459 - Release Date: 10/06/2004


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
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
Why won't this loop? Steph[_3_] Excel Programming 2 January 28th 04 05:59 PM
Worksheet_Change - loop within a loop bgm Excel Programming 1 January 19th 04 01:27 PM
For each loop Mark Excel Programming 3 December 16th 03 11:56 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


All times are GMT +1. The time now is 09:05 PM.

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

About Us

"It's about Microsoft Excel"