Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Unprotect not working


Does any one know why Unprotect is not working on the below code for the
Active Sheet.

Sub custlistcombobox()

ActiveSheet.unprotect

Dim FirstAddress As String
Dim c As Range

With Worksheets("Customer List").Range("A2:A15501")
Set c = .Find(what:=Range("C137"), LookIn:=xlValues)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
With ActiveSheet.Range("F105")

..Value = c.Offset(, 1) ' Name
..Offset(1, -3) = c.Offset(, 2) ' Phone
..Offset(1, 0) = c.Offset(, 3) ' Fax
..Offset(2, -3) = c.Offset(, 4) ' Email
..Offset(4, -3) = c.Offset(, 7) ' PST
..Offset(4, 0) = c.Offset(, 8) ' GST
..Offset(23, -2) = c.Offset(, 13) 'Customer Comments

End With
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < FirstAddress
End If
End With

ActiveSheet.Protect

End Sub


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529300

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Unprotect not working

If there is a worksheet protection password, you need to supply it to the
macro, e.g.:

ActiveSheet.Unprotect "sesame"


"bobwilson" wrote
in message ...

Does any one know why Unprotect is not working on the below code for the
Active Sheet.

Sub custlistcombobox()

ActiveSheet.unprotect

Dim FirstAddress As String
Dim c As Range

With Worksheets("Customer List").Range("A2:A15501")
Set c = .Find(what:=Range("C137"), LookIn:=xlValues)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
With ActiveSheet.Range("F105")

Value = c.Offset(, 1) ' Name
Offset(1, -3) = c.Offset(, 2) ' Phone
Offset(1, 0) = c.Offset(, 3) ' Fax
Offset(2, -3) = c.Offset(, 4) ' Email
Offset(4, -3) = c.Offset(, 7) ' PST
Offset(4, 0) = c.Offset(, 8) ' GST
Offset(23, -2) = c.Offset(, 13) 'Customer Comments

End With
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < FirstAddress
End If
End With

ActiveSheet.Protect

End Sub


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile:
http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529300



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Unprotect not working


I don't use passwords. In all my Macros I Unprotect the sheet at th
beginning of the macro and then Protect the sheet at the end. For som
reason this macro does not want to unprotect the activesheet

--
bobwilso
-----------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...fo&userid=3304
View this thread: http://www.excelforum.com/showthread.php?threadid=52930

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 unprotect a spreadsheet? Sofiya Excel Worksheet Functions 1 October 13th 08 04:30 PM
Protect/Unprotect Not Working nospaminlich Excel Programming 1 November 3rd 05 06:59 PM
Protect/Unprotect w/ VBA not working as supposed... HBj Excel Programming 3 October 7th 05 05:16 PM
Unprotect Conditional Formatting Excel Discussion (Misc queries) 3 September 5th 05 02:49 PM
Unprotect not working Stuart[_5_] Excel Programming 2 May 10th 04 07:18 PM


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