Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Step through a range?

I have a named range defined in 1 worksheet of my workbook. I want to step
through this range (e.g. 10 rows by 8 columns = 80 cells) one cell at a time
and based on a select case apply formatting to the same cell in another
worksheet in the same workbook. Can someone show me the construct to do
this? I'm no VBA expert as you can tell. Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Step through a range?

Dim cell As Range

For Each cell in Range("myRange")
Select Case cell.Value
Case 1: 'do something
'etc.
End Select
Next cell

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Kent McPherson" wrote in message
...
I have a named range defined in 1 worksheet of my workbook. I want to step
through this range (e.g. 10 rows by 8 columns = 80 cells) one cell at a
time and based on a select case apply formatting to the same cell in
another worksheet in the same workbook. Can someone show me the construct
to do this? I'm no VBA expert as you can tell. Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Step through a range?

dim currRow as long
dim currCol as integer

for currRow=myRange.Row to myRange.Row+myRange.Rows.Count
for currCol=myRange.Columnto myRange.Column+myRange.Columnes.Count
select case cells(currRow,currCol)
Case 1:

sheets("OtherSheetName").cells(currRow,currCol).nu mberformat="%0.00"
end select
next
next

Peter Richardson

"Kent McPherson" wrote:

I have a named range defined in 1 worksheet of my workbook. I want to step
through this range (e.g. 10 rows by 8 columns = 80 cells) one cell at a time
and based on a select case apply formatting to the same cell in another
worksheet in the same workbook. Can someone show me the construct to do
this? I'm no VBA expert as you can tell. Thanks.



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
Creating a Drop Down List with Step by Step Instructions for 2007 remarkable Excel Worksheet Functions 2 March 22nd 09 04:36 AM
Need step by step to add invoice numbering to excel template rmt New Users to Excel 4 July 6th 08 11:45 PM
What is the step-by-step procedure for making a data list? Bobgolfs56 Excel Discussion (Misc queries) 1 April 23rd 05 02:19 PM
I need step by step instructions to create a macro for 10 imbedde. diana Excel Worksheet Functions 3 January 31st 05 01:56 AM
How to step through top row of a Range object TBA[_3_] Excel Programming 2 January 6th 04 03:11 AM


All times are GMT +1. The time now is 08:10 AM.

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"