Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do you get a macro not to go to or change a locked cell?

I have the cells locked, the sheet protected and have only "Select unlocked
cells" and "Format cells" checked. If I turn "Format cells" off, the macro
doesn't work. Below is the macro:
Selection.Interior.ColorIndex = 4
Selection.Font.ColorIndex = 1
ActiveCell.Offset(1, 0).Range("A1").Select

It changes the fill to green, the text to black, and move down one row.

Please help.........
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default How do you get a macro not to go to or change a locked cell?

I'm not clear what you are trying to accomplish. Do you want your macro to be
able to change only an unlocked cell to green, then move down one cell if
that cell is also unlocked? If so, try this:

If ActiveCell.Locked = True Then Exit Sub
Selection.Interior.ColorIndex = 4
Selection.Font.ColorIndex = 1
If ActiveCell.Offset(1, 0).Locked = True Then Exit Sub
ActiveCell.Offset(1, 0).Select

Hope this helps,

Hutch

"bxs02205" wrote:

I have the cells locked, the sheet protected and have only "Select unlocked
cells" and "Format cells" checked. If I turn "Format cells" off, the macro
doesn't work. Below is the macro:
Selection.Interior.ColorIndex = 4
Selection.Font.ColorIndex = 1
ActiveCell.Offset(1, 0).Range("A1").Select

It changes the fill to green, the text to black, and move down one row.

Please help.........

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do you get a macro not to go to or change a locked cell?

YES :-) It worked great. You're a genius.

Thanks tons.

"Tom Hutchins" wrote:

I'm not clear what you are trying to accomplish. Do you want your macro to be
able to change only an unlocked cell to green, then move down one cell if
that cell is also unlocked? If so, try this:

If ActiveCell.Locked = True Then Exit Sub
Selection.Interior.ColorIndex = 4
Selection.Font.ColorIndex = 1
If ActiveCell.Offset(1, 0).Locked = True Then Exit Sub
ActiveCell.Offset(1, 0).Select

Hope this helps,

Hutch

"bxs02205" wrote:

I have the cells locked, the sheet protected and have only "Select unlocked
cells" and "Format cells" checked. If I turn "Format cells" off, the macro
doesn't work. Below is the macro:
Selection.Interior.ColorIndex = 4
Selection.Font.ColorIndex = 1
ActiveCell.Offset(1, 0).Range("A1").Select

It changes the fill to green, the text to black, and move down one row.

Please help.........

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
Can you run a macro while your computer is locked? dorn Excel Discussion (Misc queries) 1 November 8th 08 02:20 AM
macro that will change the font of a cell if i change a value jk Excel Discussion (Misc queries) 2 July 29th 08 04:39 PM
change locked cell if Vincent Excel Discussion (Misc queries) 2 August 22nd 07 02:12 PM
run a macro in a locked cell Ray Excel Discussion (Misc queries) 8 January 10th 06 12:02 AM
Locked Macro Project Dennis Slattery Excel Discussion (Misc queries) 0 December 1st 05 02:17 AM


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