Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Command Button not available until another command buttonhas been used
I have a userform that has an Add New Record command button and a
Submit command button. I don't want the Submit button to be available until/unless the Add New Record has been used. I'm not sure how to go about writing the code for that. Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Command Button not available until another command button
I'd probably create a named range called EnableSubmit and change it when
needed. At the beginning of the Submit code, you could read the value for the range and if it's TRUE, continue. -- HTH, Barb Reinhardt " wrote: I have a userform that has an Add New Record command button and a Submit command button. I don't want the Submit button to be available until/unless the Add New Record has been used. I'm not sure how to go about writing the code for that. Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Command Button not available until another commandbutton
On Sep 4, 11:02*am, Barb Reinhardt
wrote: I'd probably create a named range called EnableSubmit and change it when needed. * At the beginning of the Submit code, you could read the value for the range and if it's TRUE, continue. -- HTH, Barb Reinhardt " wrote: I have a userform that has an Add New Record command button and a Submit command button. *I don't want the Submit button to be available until/unless the Add New Record has been used. *I'm not sure how to go about writing the code for that. *Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed.- Hide quoted text - - Show quoted text - That sounds great but I can't get my head around it, do you have a minute that you could explain how I would do that or point me in the right direction? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Command Button not available until another command bu
This should help you get started.
Sub ReadSubmit() Dim Submit As String On Error Resume Next Submit = Evaluate(Names("Submit").Value) On Error GoTo 0 If Submit = "" Then Debug.Print "Named range submit doesn't exist" Else Debug.Print "Submit: " & Submit End If End Sub Sub DefineSubmit() Dim myName As String Dim myRefersTo As String 'Change submit to Yes myName = "Submit" myRefersTo = "=""Yes""" ThisWorkbook.Names.Add Name:=myName, RefersTo:=myRefersTo Call ReadSubmit 'Change submit to No myName = "Submit" myRefersTo = "=""No""" ThisWorkbook.Names.Add Name:="Submit", RefersTo:="=FALSE" End Sub -- HTH, Barb Reinhardt " wrote: On Sep 4, 11:02 am, Barb Reinhardt wrote: I'd probably create a named range called EnableSubmit and change it when needed. At the beginning of the Submit code, you could read the value for the range and if it's TRUE, continue. -- HTH, Barb Reinhardt " wrote: I have a userform that has an Add New Record command button and a Submit command button. I don't want the Submit button to be available until/unless the Add New Record has been used. I'm not sure how to go about writing the code for that. Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed.- Hide quoted text - - Show quoted text - That sounds great but I can't get my head around it, do you have a minute that you could explain how I would do that or point me in the right direction? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Command Button not available until another command bu
On Sep 4, 11:30*am, Barb Reinhardt
wrote: This should help you get started. Sub ReadSubmit() Dim Submit As String On Error Resume Next Submit = Evaluate(Names("Submit").Value) On Error GoTo 0 If Submit = "" Then * * Debug.Print "Named range submit doesn't exist" Else * * Debug.Print "Submit: " & Submit End If End Sub Sub DefineSubmit() Dim myName As String Dim myRefersTo As String 'Change submit to Yes myName = "Submit" myRefersTo = "=""Yes""" ThisWorkbook.Names.Add Name:=myName, RefersTo:=myRefersTo Call ReadSubmit 'Change submit to No myName = "Submit" myRefersTo = "=""No""" ThisWorkbook.Names.Add Name:="Submit", RefersTo:="=FALSE" End Sub -- HTH, Barb Reinhardt " wrote: On Sep 4, 11:02 am, Barb Reinhardt wrote: I'd probably create a named range called EnableSubmit and change it when needed. * At the beginning of the Submit code, you could read the value for the range and if it's TRUE, continue. -- HTH, Barb Reinhardt " wrote: I have a userform that has an Add New Record command button and a Submit command button. *I don't want the Submit button to be available until/unless the Add New Record has been used. *I'm not sure how to go about writing the code for that. *Currently, the user can "browse" thru existing records using my Previous and Next command buttons but I don't want them to be able to edit the record they're viewing (at this time, ultimately I do but I can't figure out the code for that either), but in the meantime I would be content with disabling the Submit button. Any suggestions are greatly welcomed.- Hide quoted text - - Show quoted text - That sounds great but I can't get my head around it, do you have a minute that you could explain how I would do that or point me in the right direction?- Hide quoted text - - Show quoted text - That definitely gets me started. I'm a VBA newbie so I understand what I need to do, but not how to get there. Thanks a million! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
short key to invoke command button in userform | Excel Programming | |||
Use Command Button from each Row to fill UserForm | Excel Programming | |||
userform command button checkbox problem | Excel Programming | |||
need to minimize userform via command button on itself | Excel Programming | |||
Specifying a Command Button on a worksheet as differentiated from one on a UserForm | Excel Programming |