Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Larry, Thank you for the input. The code did work, but I do have another
small problem. I used the code as a macro and assigned it to a button. Ideally, we want users to be able to click the button to generate a po#......which it does, but we also want the cell locked so they cannot change the number or create their own. When the macro is run a box pops up asking for a password as the cell has been locked. Is there a way to put that into the code so the macro will run and not generate that message? Thank you Cathy |
#2
![]() |
|||
|
|||
![]()
I don't know what the original code looks like but you probably need to
unprotect the sheet and protect it again in your macro something like: ActiveSheet.Unprotect Password:="thepassword" 'rest of code ActiveSheet.Protect Password:="thepassword" Hope this helps Rowan "Cathy Landry" wrote: Larry, Thank you for the input. The code did work, but I do have another small problem. I used the code as a macro and assigned it to a button. Ideally, we want users to be able to click the button to generate a po#......which it does, but we also want the cell locked so they cannot change the number or create their own. When the macro is run a box pops up asking for a password as the cell has been locked. Is there a way to put that into the code so the macro will run and not generate that message? Thank you Cathy |
#3
![]() |
|||
|
|||
![]()
Rowan, this is the code I told her to use:
Private Sub Workbook_Open() Dim FName As String Dim FNo As String Dim x As Long FName = ThisWorkbook.Path & Application.PathSeparator & "Number.Txt" FNo = FreeFile x = 0 On Error Resume Next Open FName For Input As #FNo Input #FNo, x x = x + 1 ' *** Change range reference to suit *** Range("K1").Value = x Close #FNo FNo = FreeFile Open FName For Output As #FNo Write #1, x Close #FNo End Sub Kathy, you really should have posted this on your original posting so as not to confuse readers. Larry "Rowan" wrote: I don't know what the original code looks like but you probably need to unprotect the sheet and protect it again in your macro something like: ActiveSheet.Unprotect Password:="thepassword" 'rest of code ActiveSheet.Protect Password:="thepassword" Hope this helps Rowan "Cathy Landry" wrote: Larry, Thank you for the input. The code did work, but I do have another small problem. I used the code as a macro and assigned it to a button. Ideally, we want users to be able to click the button to generate a po#......which it does, but we also want the cell locked so they cannot change the number or create their own. When the macro is run a box pops up asking for a password as the cell has been locked. Is there a way to put that into the code so the macro will run and not generate that message? Thank you Cathy |
#4
![]() |
|||
|
|||
![]()
Thank you all for your help! Is there a class (online) that teaches the
novice in Visual Basic? Cathy "Rowan" wrote: I don't know what the original code looks like but you probably need to unprotect the sheet and protect it again in your macro something like: ActiveSheet.Unprotect Password:="thepassword" 'rest of code ActiveSheet.Protect Password:="thepassword" Hope this helps Rowan "Cathy Landry" wrote: Larry, Thank you for the input. The code did work, but I do have another small problem. I used the code as a macro and assigned it to a button. Ideally, we want users to be able to click the button to generate a po#......which it does, but we also want the cell locked so they cannot change the number or create their own. When the macro is run a box pops up asking for a password as the cell has been locked. Is there a way to put that into the code so the macro will run and not generate that message? Thank you Cathy |
#5
![]() |
|||
|
|||
![]()
You might want to check out "Mr. Excel" at www.mrexcel.com it's a great place
to post questions and problems. They also have some books and videos that you might find useful. Larry "Cathy Landry" wrote: Thank you all for your help! Is there a class (online) that teaches the novice in Visual Basic? Cathy "Rowan" wrote: I don't know what the original code looks like but you probably need to unprotect the sheet and protect it again in your macro something like: ActiveSheet.Unprotect Password:="thepassword" 'rest of code ActiveSheet.Protect Password:="thepassword" Hope this helps Rowan "Cathy Landry" wrote: Larry, Thank you for the input. The code did work, but I do have another small problem. I used the code as a macro and assigned it to a button. Ideally, we want users to be able to click the button to generate a po#......which it does, but we also want the cell locked so they cannot change the number or create their own. When the macro is run a box pops up asking for a password as the cell has been locked. Is there a way to put that into the code so the macro will run and not generate that message? Thank you Cathy |
#6
![]() |
|||
|
|||
![]()
Thank you! You have all been very helpful.
"Larry E" wrote: You might want to check out "Mr. Excel" at www.mrexcel.com it's a great place to post questions and problems. They also have some books and videos that you might find useful. Larry "Cathy Landry" wrote: Thank you all for your help! Is there a class (online) that teaches the novice in Visual Basic? Cathy "Rowan" wrote: I don't know what the original code looks like but you probably need to unprotect the sheet and protect it again in your macro something like: ActiveSheet.Unprotect Password:="thepassword" 'rest of code ActiveSheet.Protect Password:="thepassword" Hope this helps Rowan "Cathy Landry" wrote: Larry, Thank you for the input. The code did work, but I do have another small problem. I used the code as a macro and assigned it to a button. Ideally, we want users to be able to click the button to generate a po#......which it does, but we also want the cell locked so they cannot change the number or create their own. When the macro is run a box pops up asking for a password as the cell has been locked. Is there a way to put that into the code so the macro will run and not generate that message? Thank you Cathy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I assign sequential numbers in an Excel 2003 PO template? | Excel Worksheet Functions | |||
In Excel, I want to have all telephone numbers display in the sam. | Excel Worksheet Functions | |||
Excel countif based on size of numbers in one column in Access | Excel Worksheet Functions | |||
Numbers after decimal point excel to word mail merge | Excel Worksheet Functions | |||
how do i set up to auto detect duplicated numbers in an excel fiel | Excel Discussion (Misc queries) |