Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How select unlocked cells only

Hi,

I need to select the unlocked cells in an excel sheet that I have
protected.
The scope is to format those cells with a different colour to make
easier for the enduser to spot them.

I have found the following macro in the newsgroup:

Sub FindUnlocked()
Dim c As Range
Dim sel As String
Dim sel2 As String
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then
sel = sel & "," & c.Address
End If
Next
sel2 = Right(sel, Len(sel) - 1)
Range(sel2).Select
End Sub

This is supposed to do the job but when I run it, I get the following
error:

Run-time error '1004':
Method 'range' of object'_Global' failed

Do you know what it means and how to solve it?
I use Excel 2000

Thank you
Alex
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default How select unlocked cells only

Hi
why not use something like
Sub FindUnlocked()
Dim c As Range
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then
c.interior.colorindex=3
End If
Next
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany


Metallo wrote:
Hi,

I need to select the unlocked cells in an excel sheet that I have
protected.
The scope is to format those cells with a different colour to make
easier for the enduser to spot them.

I have found the following macro in the newsgroup:

Sub FindUnlocked()
Dim c As Range
Dim sel As String
Dim sel2 As String
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then
sel = sel & "," & c.Address
End If
Next
sel2 = Right(sel, Len(sel) - 1)
Range(sel2).Select
End Sub

This is supposed to do the job but when I run it, I get the following
error:

Run-time error '1004':
Method 'range' of object'_Global' failed

Do you know what it means and how to solve it?
I use Excel 2000

Thank you
Alex


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How select unlocked cells only

Hi Alex,

As an alternative approach, you could use conditional formatting and set the
Formula Is condition to:

=CELL("protect",A1)

---
Regards,
Norman


"Metallo" wrote in message
om...
Hi,

I need to select the unlocked cells in an excel sheet that I have
protected.
The scope is to format those cells with a different colour to make
easier for the enduser to spot them.

I have found the following macro in the newsgroup:

Sub FindUnlocked()
Dim c As Range
Dim sel As String
Dim sel2 As String
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then
sel = sel & "," & c.Address
End If
Next
sel2 = Right(sel, Len(sel) - 1)
Range(sel2).Select
End Sub

This is supposed to do the job but when I run it, I get the following
error:

Run-time error '1004':
Method 'range' of object'_Global' failed

Do you know what it means and how to solve it?
I use Excel 2000

Thank you
Alex



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default How select unlocked cells only

Hi,

Thank you guys for your solutions, I'm going to try both and see which one
will work best.

Cheers
Alex

"Norman Jones" wrote in message
...
Hi Alex,

As an alternative approach, you could use conditional formatting and set

the
Formula Is condition to:

=CELL("protect",A1)

---
Regards,
Norman


"Metallo" wrote in message
om...
Hi,

I need to select the unlocked cells in an excel sheet that I have
protected.
The scope is to format those cells with a different colour to make
easier for the enduser to spot them.

I have found the following macro in the newsgroup:

Sub FindUnlocked()
Dim c As Range
Dim sel As String
Dim sel2 As String
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then
sel = sel & "," & c.Address
End If
Next
sel2 = Right(sel, Len(sel) - 1)
Range(sel2).Select
End Sub

This is supposed to do the job but when I run it, I get the following
error:

Run-time error '1004':
Method 'range' of object'_Global' failed

Do you know what it means and how to solve it?
I use Excel 2000

Thank you
Alex





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
Locked Several Worksheets, allow format cells/select unlocked cell Ana24 Excel Discussion (Misc queries) 2 September 26th 09 01:15 AM
Moving from unlocked cells to unlocked cells in an excel form Stacey Lee Excel Worksheet Functions 1 April 24th 06 08:44 PM
how do you "select locked cells" w/o "select unlocked cells"? princejohnpaulfin Excel Discussion (Misc queries) 3 July 16th 05 03:53 AM
Password Protection - Select Unlocked Cells Only Tenk Excel Programming 1 May 18th 04 12:19 PM
Select all the unlocked cells on a worksheet Steven Revell Excel Programming 2 November 11th 03 12:30 PM


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