Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Protect hidden rows/columns -macro help

I have financial reports that have hidden rows columns once generated. When
data is selected, the hidden rows/columns data is still selected when pasted.
Can someone suggest a macro that can be run to protect/thus lock and prevent
selection of hidden rows and columns?
Thanks!
=)
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Protect hidden rows/columns -macro help

To add further clarification to what I'm looking for the scenario I was
thinking is this:

1)If I knew the attribute to a row/column that is hidden, I could use it in
the macro, and then LOCK those rows/columns that were hidden.
2) Then, I would Protect the sheet with password and allow selection on only
the unlocked rows/columns.

Is this fairly simple?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 156
Default Protect hidden rows/columns -macro help

Not too sure exactly what you are trying to do but here's some code
that might help. This will look through all the rows in the range(I
used range A1 to A10) and if a row is hidden it will lock it.

Sub FindHiddenAndLock()
Dim mcell, MyRange As Range
Set MyRange = Range("A1:A10")
For Each mcell In MyRange
If mcell.Rows.Hidden = True Then
mcell.Rows.Locked = True
End If
Next
End Sub

Sandy


ttbbgg wrote:
To add further clarification to what I'm looking for the scenario I was
thinking is this:

1)If I knew the attribute to a row/column that is hidden, I could use it in
the macro, and then LOCK those rows/columns that were hidden.
2) Then, I would Protect the sheet with password and allow selection on only
the unlocked rows/columns.

Is this fairly simple?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Protect hidden rows/columns -macro help

This seems to work really well, but now the user cannot do a continuous
selection of what cells are unlocked. Could we change this requirement of
locking the cells to just deleting the entire row and column that is already
hidden?
Would the code go as follows?

If mcell.Rows.Hidden = True Then
DELETE

Please note that I have hidden columns as well that I'd like removed.

"Sandy" wrote:

Not too sure exactly what you are trying to do but here's some code
that might help. This will look through all the rows in the range(I
used range A1 to A10) and if a row is hidden it will lock it.

Sub FindHiddenAndLock()
Dim mcell, MyRange As Range
Set MyRange = Range("A1:A10")
For Each mcell In MyRange
If mcell.Rows.Hidden = True Then
mcell.Rows.Locked = True
End If
Next
End Sub

Sandy


ttbbgg wrote:
To add further clarification to what I'm looking for the scenario I was
thinking is this:

1)If I knew the attribute to a row/column that is hidden, I could use it in
the macro, and then LOCK those rows/columns that were hidden.
2) Then, I would Protect the sheet with password and allow selection on only
the unlocked rows/columns.

Is this fairly simple?



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Protect hidden rows/columns -macro help

This is just deleting the first cell in the hidden row. I need the entire
row deleted so as to shift all the unhidden rows up.

"Sandy" wrote:

Not too sure exactly what you are trying to do but here's some code
that might help. This will look through all the rows in the range(I
used range A1 to A10) and if a row is hidden it will lock it.

Sub FindHiddenAndLock()
Dim mcell, MyRange As Range
Set MyRange = Range("A1:A10")
For Each mcell In MyRange
If mcell.Rows.Hidden = True Then
mcell.Rows.Locked = True
End If
Next
End Sub

Sandy


ttbbgg wrote:
To add further clarification to what I'm looking for the scenario I was
thinking is this:

1)If I knew the attribute to a row/column that is hidden, I could use it in
the macro, and then LOCK those rows/columns that were hidden.
2) Then, I would Protect the sheet with password and allow selection on only
the unlocked rows/columns.

Is this fairly simple?



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
How do I password protect hidden sheet? Mascot Excel Discussion (Misc queries) 1 October 5th 06 03:52 PM
protect / unprotect VBA project by macro sylvain Excel Discussion (Misc queries) 0 July 31st 06 06:09 PM
macro to hidden worksheet murph306 Excel Discussion (Misc queries) 8 June 1st 06 02:35 PM
Add protect worksheet password in macro Kelly Excel Worksheet Functions 1 January 10th 06 02:08 AM
hidden rows/columns RC Excel Discussion (Misc queries) 0 January 30th 05 03:39 PM


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