Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to lock the Ctrl key? (as locking the Shift key w/Caps Lock) | Excel Discussion (Misc queries) | |||
how do I undo the scroll lock, thscroll lock button does not work | Excel Discussion (Misc queries) | |||
I have lock a wookbook but one cell does not want to lock it | Excel Discussion (Misc queries) | |||
I have lock a wookbook but one cell does not want to lock it | Excel Discussion (Misc queries) | |||
How can Excel vba detect if Caps Lock or Num Lock is on? | Excel Programming |