Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to initialise a form. I would like it clear all the text boxes,
except the last one should be popluated with "Yes" (but the user can enter whatever info is appropriate is "yes" is not). The set.focus command works, but the last box is still empty. What am I doing wrong? Private Sub EnterNewConsult_Initialize() txtStore.Value = "" txtCustomerName.Value = "" txtClosed.Value = "yes" txtStore.SetFocus End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Change this:
Private Sub EnterNewConsult_Initialize() To this: Private Sub UserForm_Initialize() It does not recognize the UserForm name for the Initialize event, It has to be the constant provided by microsoft. "Jacy Erdelt" wrote: I am trying to initialise a form. I would like it clear all the text boxes, except the last one should be popluated with "Yes" (but the user can enter whatever info is appropriate is "yes" is not). The set.focus command works, but the last box is still empty. What am I doing wrong? Private Sub EnterNewConsult_Initialize() txtStore.Value = "" txtCustomerName.Value = "" txtClosed.Value = "yes" txtStore.SetFocus End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this:
Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change this to match the name of your button!! Dim C As MSForms.Control For Each C In Me.Controls If TypeOf C Is MSForms.TextBox Then C.Text = "" End If Next C End Sub Regards, Ryan--- -- RyGuy "JLGWhiz" wrote: Change this: Private Sub EnterNewConsult_Initialize() To this: Private Sub UserForm_Initialize() It does not recognize the UserForm name for the Initialize event, It has to be the constant provided by microsoft. "Jacy Erdelt" wrote: I am trying to initialise a form. I would like it clear all the text boxes, except the last one should be popluated with "Yes" (but the user can enter whatever info is appropriate is "yes" is not). The set.focus command works, but the last box is still empty. What am I doing wrong? Private Sub EnterNewConsult_Initialize() txtStore.Value = "" txtCustomerName.Value = "" txtClosed.Value = "yes" txtStore.SetFocus End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Huh? Ryan, are you on the correct thread?
"ryguy7272" wrote: Try this: Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change this to match the name of your button!! Dim C As MSForms.Control For Each C In Me.Controls If TypeOf C Is MSForms.TextBox Then C.Text = "" End If Next C End Sub Regards, Ryan--- -- RyGuy "JLGWhiz" wrote: Change this: Private Sub EnterNewConsult_Initialize() To this: Private Sub UserForm_Initialize() It does not recognize the UserForm name for the Initialize event, It has to be the constant provided by microsoft. "Jacy Erdelt" wrote: I am trying to initialise a form. I would like it clear all the text boxes, except the last one should be popluated with "Yes" (but the user can enter whatever info is appropriate is "yes" is not). The set.focus command works, but the last box is still empty. What am I doing wrong? Private Sub EnterNewConsult_Initialize() txtStore.Value = "" txtCustomerName.Value = "" txtClosed.Value = "yes" txtStore.SetFocus End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I read clear all the text boxes'. I forgot about the part about the 'last
one should be popluated with "Yes"'. My code clears all text boxes; I use the code occasionally and it works great. What did I miss? Thanks, Ryan--- -- RyGuy "JLGWhiz" wrote: Huh? Ryan, are you on the correct thread? "ryguy7272" wrote: Try this: Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change this to match the name of your button!! Dim C As MSForms.Control For Each C In Me.Controls If TypeOf C Is MSForms.TextBox Then C.Text = "" End If Next C End Sub Regards, Ryan--- -- RyGuy "JLGWhiz" wrote: Change this: Private Sub EnterNewConsult_Initialize() To this: Private Sub UserForm_Initialize() It does not recognize the UserForm name for the Initialize event, It has to be the constant provided by microsoft. "Jacy Erdelt" wrote: I am trying to initialise a form. I would like it clear all the text boxes, except the last one should be popluated with "Yes" (but the user can enter whatever info is appropriate is "yes" is not). The set.focus command works, but the last box is still empty. What am I doing wrong? Private Sub EnterNewConsult_Initialize() txtStore.Value = "" txtCustomerName.Value = "" txtClosed.Value = "yes" txtStore.SetFocus End Sub |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think it will work OK if he uses the correct syntax for the
UserForm_Initialize event. I thought you had posted to the wrong thread. "ryguy7272" wrote: I read clear all the text boxes'. I forgot about the part about the 'last one should be popluated with "Yes"'. My code clears all text boxes; I use the code occasionally and it works great. What did I miss? Thanks, Ryan--- -- RyGuy "JLGWhiz" wrote: Huh? Ryan, are you on the correct thread? "ryguy7272" wrote: Try this: Private Sub cmdNewPT_Click() 'my CommandButton is named 'cmdNewPT'...change this to match the name of your button!! Dim C As MSForms.Control For Each C In Me.Controls If TypeOf C Is MSForms.TextBox Then C.Text = "" End If Next C End Sub Regards, Ryan--- -- RyGuy "JLGWhiz" wrote: Change this: Private Sub EnterNewConsult_Initialize() To this: Private Sub UserForm_Initialize() It does not recognize the UserForm name for the Initialize event, It has to be the constant provided by microsoft. "Jacy Erdelt" wrote: I am trying to initialise a form. I would like it clear all the text boxes, except the last one should be popluated with "Yes" (but the user can enter whatever info is appropriate is "yes" is not). The set.focus command works, but the last box is still empty. What am I doing wrong? Private Sub EnterNewConsult_Initialize() txtStore.Value = "" txtCustomerName.Value = "" txtClosed.Value = "yes" txtStore.SetFocus End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Data Changes itself after I have inputted. | Excel Discussion (Misc queries) | |||
Autofilter to tak on an Inputted Value | Excel Programming | |||
Getting Last Value that inputted | Excel Discussion (Misc queries) | |||
Read Last Inputted Value? | Excel Programming | |||
Due date changes when new value is inputted in a different column | Excel Programming |