Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Protecting data rather than certain cells

Hello,

I locked certain cells on my worksheet, and then protected
the worksheet. However, now I wish to sort the data, but
keep the data that was in the protected cells protected.
Since certain cells are locked and not data, when I
perform a sort, only those same cells are protected,
rather than the data being protected. Is there any way I
can protect the data instead?

Thanks for the help!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Protecting data rather than certain cells

One way might be to change the background of the cells
containing the data I want locked (call it old data) to
green. Then I enter my new data (that doesn't need to be
protected)on white rows. Then I can sort the data, and
close the spreadsheet.

Every time the spreadsheet opens, I could have a macro
that does the following:

- Checks if the worksheet is protected, and if so
unprotects it
- for all cells, if background is green, lock, else unlock
- reprotect the sheet.

Can anyone see a problem with this? Also, can anyone help
me code the macro or provide me some resources to do so?

Thanks.

-----Original Message-----
Hello,

I locked certain cells on my worksheet, and then

protected
the worksheet. However, now I wish to sort the data, but
keep the data that was in the protected cells protected.
Since certain cells are locked and not data, when I
perform a sort, only those same cells are protected,
rather than the data being protected. Is there any way I
can protect the data instead?

Thanks for the help!


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Protecting data rather than certain cells

Dim cell as Range
ActiveSheet.Unprotect
Cells.Locked = False
for each cell in Range("A1").CurrentRegion
if cell.Interior.ColorIndex = 4 then
cell.Locked = True
end if
Next
ActiveSheet.Protect

--
Regards,
Tom Ogilvy

"mika." wrote in message
...
One way might be to change the background of the cells
containing the data I want locked (call it old data) to
green. Then I enter my new data (that doesn't need to be
protected)on white rows. Then I can sort the data, and
close the spreadsheet.

Every time the spreadsheet opens, I could have a macro
that does the following:

- Checks if the worksheet is protected, and if so
unprotects it
- for all cells, if background is green, lock, else unlock
- reprotect the sheet.

Can anyone see a problem with this? Also, can anyone help
me code the macro or provide me some resources to do so?

Thanks.

-----Original Message-----
Hello,

I locked certain cells on my worksheet, and then

protected
the worksheet. However, now I wish to sort the data, but
keep the data that was in the protected cells protected.
Since certain cells are locked and not data, when I
perform a sort, only those same cells are protected,
rather than the data being protected. Is there any way I
can protect the data instead?

Thanks for the 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
Excel 2003 - Protecting Cells but allowing external data updates watermt Excel Worksheet Functions 3 August 3rd 09 05:31 PM
protecting cells Tami Excel Worksheet Functions 2 June 5th 08 02:12 AM
Protecting cells but maintaing data groups DannyS Excel Discussion (Misc queries) 2 January 12th 07 12:21 PM
Protecting Validated cells from pasting over data Pendelfin Excel Discussion (Misc queries) 0 November 15th 06 02:41 PM
Protecting cells GregP1962 Excel Discussion (Misc queries) 2 June 7th 06 10:55 PM


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