Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have created a workbook to score high school swim meets. In the header, I
have placed team names, date, etc. I would like to write some code so that when I open the template, a form pops up, and by completing the form, the header information will be filled in automatically. For example: Home team? Visiting eam? Date? Pool location? Can someone help me with this, or suggest another way to accomplish the same thing? Thanks, ~ Horatio |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You can build your own userform:
Check Debra Dalgleish's site: http://contextures.com/xlUserForm01.html and these articles by Peter Aiken: http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx Then you could create a macro in a General module that shows your form each time the workbook is opened: Option Explict Sub Auto_Open() UserForm1.show End Sub Horatio J. Bilge, Jr. wrote: I have created a workbook to score high school swim meets. In the header, I have placed team names, date, etc. I would like to write some code so that when I open the template, a form pops up, and by completing the form, the header information will be filled in automatically. For example: Home team? Visiting eam? Date? Pool location? Can someone help me with this, or suggest another way to accomplish the same thing? Thanks, ~ Horatio -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Dave. This looks like it should work. I'll try it out.
~ Horatio "Dave Peterson" wrote: You can build your own userform: Check Debra Dalgleish's site: http://contextures.com/xlUserForm01.html and these articles by Peter Aiken: http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx Then you could create a macro in a General module that shows your form each time the workbook is opened: Option Explict Sub Auto_Open() UserForm1.show End Sub Horatio J. Bilge, Jr. wrote: I have created a workbook to score high school swim meets. In the header, I have placed team names, date, etc. I would like to write some code so that when I open the template, a form pops up, and by completing the form, the header information will be filled in automatically. For example: Home team? Visiting eam? Date? Pool location? Can someone help me with this, or suggest another way to accomplish the same thing? Thanks, ~ Horatio -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I've made a form, but so far, I can't get it to load when I open the
workbook, so I haven't been able to test if it works correctly. The form is named MeetInfo. I put the following code under ThisWorkbook. Option Explicit Sub Auto_Open() MeetInfo.Show End Sub Did I put it in the wrong place, or is there another step that I need to do? Thanks, ~ Horatio "Dave Peterson" wrote: You can build your own userform: Check Debra Dalgleish's site: http://contextures.com/xlUserForm01.html and these articles by Peter Aiken: http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx Then you could create a macro in a General module that shows your form each time the workbook is opened: Option Explict Sub Auto_Open() UserForm1.show End Sub Horatio J. Bilge, Jr. wrote: I have created a workbook to score high school swim meets. In the header, I have placed team names, date, etc. I would like to write some code so that when I open the template, a form pops up, and by completing the form, the header information will be filled in automatically. For example: Home team? Visiting eam? Date? Pool location? Can someone help me with this, or suggest another way to accomplish the same thing? Thanks, ~ Horatio -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You have a couple of choices.
One move your macro to a General module--not behind ThisWorkbook and not behind a worksheet. And keep that same name (Auto_Open). Or keep the code in the same location and rename the procedu Option Explicit Private Sub Workbook_Open() MeetInfo.show End Sub Horatio J. Bilge, Jr. wrote: I've made a form, but so far, I can't get it to load when I open the workbook, so I haven't been able to test if it works correctly. The form is named MeetInfo. I put the following code under ThisWorkbook. Option Explicit Sub Auto_Open() MeetInfo.Show End Sub Did I put it in the wrong place, or is there another step that I need to do? Thanks, ~ Horatio "Dave Peterson" wrote: You can build your own userform: Check Debra Dalgleish's site: http://contextures.com/xlUserForm01.html and these articles by Peter Aiken: http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx Then you could create a macro in a General module that shows your form each time the workbook is opened: Option Explict Sub Auto_Open() UserForm1.show End Sub Horatio J. Bilge, Jr. wrote: I have created a workbook to score high school swim meets. In the header, I have placed team names, date, etc. I would like to write some code so that when I open the template, a form pops up, and by completing the form, the header information will be filled in automatically. For example: Home team? Visiting eam? Date? Pool location? Can someone help me with this, or suggest another way to accomplish the same thing? Thanks, ~ Horatio -- Dave Peterson -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I changed the code to Workbook_Open() and it now opens correctly when I open
the workbook. It appears to work well up to the point where it should copy the data into cells in the workbook. I want the values from the four textboxes to go into cells A1:A4 on the worksheet "Meet." Here is the code I adapted from Debra Dalgleish's site: Private Sub CmdUpdate_Click() Dim ws As Worksheet Set ws = Worksheets("Meet") 'check for Home Team If Trim(Me.txtHome.Value) = "" Then Me.txtHome.SetFocus MsgBox "Please enter the Home Team" Exit Sub End If 'check for Visiting Team If Trim(Me.txtVisiting.Value) = "" Then Me.txtVisiting.SetFocus MsgBox "Please enter the Visiting Team" Exit Sub End If 'check for Pool Location If Trim(Me.txtPool.Value) = "" Then Me.txtPool.SetFocus MsgBox "Please enter the Pool Location" Exit Sub End If 'check for Date If Trim(Me.txtDate.Value) = "" Then Me.txtDate.SetFocus MsgBox "Please enter the Date (m/dd/yyyy)" Exit Sub End If 'copy the data to the workbook ws.Cells(A1).Value = Me.txtHome.Value ws.Cells(A2).Value = Me.txtVisiting.Value ws.Cells(A3).Value = Me.txtPool.Value ws.Cells(A4).Value = Me.txtDate.Value 'close the MeetInfo form Unload Me End Sub "Dave Peterson" wrote: You have a couple of choices. One move your macro to a General module--not behind ThisWorkbook and not behind a worksheet. And keep that same name (Auto_Open). Or keep the code in the same location and rename the procedu Option Explicit Private Sub Workbook_Open() MeetInfo.show End Sub Horatio J. Bilge, Jr. wrote: I've made a form, but so far, I can't get it to load when I open the workbook, so I haven't been able to test if it works correctly. The form is named MeetInfo. I put the following code under ThisWorkbook. Option Explicit Sub Auto_Open() MeetInfo.Show End Sub Did I put it in the wrong place, or is there another step that I need to do? Thanks, ~ Horatio "Dave Peterson" wrote: You can build your own userform: Check Debra Dalgleish's site: http://contextures.com/xlUserForm01.html and these articles by Peter Aiken: http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx Then you could create a macro in a General module that shows your form each time the workbook is opened: Option Explict Sub Auto_Open() UserForm1.show End Sub Horatio J. Bilge, Jr. wrote: I have created a workbook to score high school swim meets. In the header, I have placed team names, date, etc. I would like to write some code so that when I open the template, a form pops up, and by completing the form, the header information will be filled in automatically. For example: Home team? Visiting eam? Date? Pool location? Can someone help me with this, or suggest another way to accomplish the same thing? Thanks, ~ Horatio -- Dave Peterson -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I got it figured out. I changed the section of code that copies data to the
worksheet: 'copy the data to the workbook ws.Cells(1,1).Value = Me.txtHome.Value ws.Cells(1,2).Value = Me.txtVisiting.Value ws.Cells(1,3).Value = Me.txtPool.Value ws.Cells(1,4).Value = Me.txtDate.Value "Horatio J. Bilge, Jr." wrote: I changed the code to Workbook_Open() and it now opens correctly when I open the workbook. It appears to work well up to the point where it should copy the data into cells in the workbook. I want the values from the four textboxes to go into cells A1:A4 on the worksheet "Meet." Here is the code I adapted from Debra Dalgleish's site: Private Sub CmdUpdate_Click() Dim ws As Worksheet Set ws = Worksheets("Meet") 'check for Home Team If Trim(Me.txtHome.Value) = "" Then Me.txtHome.SetFocus MsgBox "Please enter the Home Team" Exit Sub End If 'check for Visiting Team If Trim(Me.txtVisiting.Value) = "" Then Me.txtVisiting.SetFocus MsgBox "Please enter the Visiting Team" Exit Sub End If 'check for Pool Location If Trim(Me.txtPool.Value) = "" Then Me.txtPool.SetFocus MsgBox "Please enter the Pool Location" Exit Sub End If 'check for Date If Trim(Me.txtDate.Value) = "" Then Me.txtDate.SetFocus MsgBox "Please enter the Date (m/dd/yyyy)" Exit Sub End If 'copy the data to the workbook ws.Cells(A1).Value = Me.txtHome.Value ws.Cells(A2).Value = Me.txtVisiting.Value ws.Cells(A3).Value = Me.txtPool.Value ws.Cells(A4).Value = Me.txtDate.Value 'close the MeetInfo form Unload Me End Sub "Dave Peterson" wrote: You have a couple of choices. One move your macro to a General module--not behind ThisWorkbook and not behind a worksheet. And keep that same name (Auto_Open). Or keep the code in the same location and rename the procedu Option Explicit Private Sub Workbook_Open() MeetInfo.show End Sub Horatio J. Bilge, Jr. wrote: I've made a form, but so far, I can't get it to load when I open the workbook, so I haven't been able to test if it works correctly. The form is named MeetInfo. I put the following code under ThisWorkbook. Option Explicit Sub Auto_Open() MeetInfo.Show End Sub Did I put it in the wrong place, or is there another step that I need to do? Thanks, ~ Horatio "Dave Peterson" wrote: You can build your own userform: Check Debra Dalgleish's site: http://contextures.com/xlUserForm01.html and these articles by Peter Aiken: http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx Then you could create a macro in a General module that shows your form each time the workbook is opened: Option Explict Sub Auto_Open() UserForm1.show End Sub Horatio J. Bilge, Jr. wrote: I have created a workbook to score high school swim meets. In the header, I have placed team names, date, etc. I would like to write some code so that when I open the template, a form pops up, and by completing the form, the header information will be filled in automatically. For example: Home team? Visiting eam? Date? Pool location? Can someone help me with this, or suggest another way to accomplish the same thing? Thanks, ~ Horatio -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I stop the automatic opening of Template Help in Excel? | Excel Discussion (Misc queries) | |||
how to generate a unique form # when using an excel form template | Excel Worksheet Functions | |||
How do I create a form template that will be sequential numbered | Excel Discussion (Misc queries) | |||
Opening a template form & renaming it from a cell input automatica | Excel Discussion (Misc queries) | |||
create a data entry form template in Excel 2003? | Excel Discussion (Misc queries) |