Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Loop for changing cell formatting

I have a group of cells that I have renamed cell1,cell2,cell3... and so on up to 30. I would like to take the number from the cell name and put it in a loop until it reaches 30. While it is in the loop, I would like each cell that matches the number to have protection placed on it. Any help would be great. Thanks. Matt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Loop for changing cell formatting

Dim rng as Range
Dim i as long
for i = 1 to 30
set rng = Thisworkbook.Names("cell" & i).RefersToRange
rng.locked = True
next

--
Regards,
Tom Ogilvy

"Matt" wrote in message
...
I have a group of cells that I have renamed cell1,cell2,cell3... and so on

up to 30. I would like to take the number from the cell name and put it in
a loop until it reaches 30. While it is in the loop, I would like each cell
that matches the number to have protection placed on it. Any help would be
great. Thanks. Matt


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
Changing background colour when changing data in a cell Paoul Excel Discussion (Misc queries) 7 December 26th 08 07:25 AM
Conditional formatting changing relative when copied to other cell robbin Excel Worksheet Functions 1 September 5th 07 11:36 PM
Problems changing cell formatting SteveB Excel Discussion (Misc queries) 3 April 25th 06 05:13 PM
Changing cell formatting with IF function Bruise Excel Worksheet Functions 6 May 21st 05 11:40 PM
get for loop to go on after blank cell? john_t_h[_12_] Excel Programming 3 January 15th 04 06:35 AM


All times are GMT +1. The time now is 04:46 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"