Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Lock

A1 is invoice number that I would enter. The following cells contain these
invoices E1 = 101, G1 = 102, I1 = 103, etc...
A4, B3, B5, C6 is information that I enter corresponding to invoice # that I
entered in A1. If the invoice # that I enter in A1 is 101 then the info that
I entered in A4,B3,B5,C6 are copied to corresponding invoice which is E1
therfore cells F1,F2,F3,F4. If the invoice # I enter is 102 then the info is
copied to H1,H2,H3,H4. Etc with 103,104..... When the invoice 101 is copied
to F1:F4 I want
F1:F4 to be locked so numbers cannot be changed and so on. I have locked
the cells in F1-4 and H1-4 and have the the sheet unprotected. The code I
now have is locking both F1-4 and H1-4 after completing just invoice 101. It
reads:
Private Sub CommandButton1_Click()
If Range("A1").Value = Range("E1") Then
Range("F1").Value = Range("A4").Value
Range("F2").Value = Range("B5").Value
Range("F3").Value = Range("C6").Value
Range("F4").Value = Range("B3").Value
Range("A4").Value = ""
Range("B5").Value = ""
Range("C6").Value = ""
Range("B3").Value = ""
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

End If
If Range("A1").Value = Range("G1") Then
Range("H1").Value = Range("A4").Value
Range("H2").Value = Range("B5").Value
Range("H3").Value = Range("C6").Value
Range("H4").Value = Range("B3").Value
Range("A4").Value = ""
Range("B5").Value = ""
Range("C6").Value = ""
Range("B3").Value = ""
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True


I hope my question is clear
End If
End Sub

Any help would be appreciated.
Thanks
Bobby
 
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 to lock the Ctrl key? (as locking the Shift key w/Caps Lock) Rick-cel Excel Discussion (Misc queries) 2 August 5th 09 06:45 PM
how do I undo the scroll lock, thscroll lock button does not work scroll lock Excel Discussion (Misc queries) 3 July 19th 08 10:17 PM
I have lock a wookbook but one cell does not want to lock it Mimi Excel Discussion (Misc queries) 2 January 21st 07 10:59 PM
I have lock a wookbook but one cell does not want to lock it Mimi Excel Discussion (Misc queries) 1 January 21st 07 09:44 AM
How can Excel vba detect if Caps Lock or Num Lock is on? abc[_6_] Excel Programming 2 December 2nd 05 06:14 AM


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