View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Anthony[_5_] Anthony[_5_] is offline
external usenet poster
 
Posts: 34
Default Dialog box upon opening workbook

On Jan 7, 7:19*am, Anthony wrote:
On Jan 6, 8:03*pm, Gord Dibben <gorddibbATshawDOTca wrote:





Have a look here at Debra Dalgleish's site.


http://www.contextures.on.ca/xlUserForm01.html


Gord


On Tue, 6 Jan 2009 03:08:08 -0800 (PST), Anthony


wrote:
On Jan 6, 3:06*am, Gord Dibben <gorddibbATshawDOTca wrote:
I think Bob assumes you created a UserForm named Leave


Did you do that?


I don't think you can do that by recording a macro.


Gord Dibben *MS Excel MVP


On Mon, 5 Jan 2009 10:55:13 -0800 (PST), Anthony


wrote:
I have done this and I get the same error message. *Is there something
that I need to do with regards to the data form. *If I run the macro
without the VB code you provided, it opens the data form without any
issues. *I created the data form using the record macro function in
Excel 2007 if that makes a difference; it is named "Leave". *Sorry for
all the questions. *Thanks again.- Hide quoted text -


- Show quoted text -


Oh, I have not done a Userform before. *I will have to find a tutorial
that teaches me how to create one. *Thanks for the info.- Hide quoted text -


- Show quoted text -


I changed a little of the code and got it to work ALMOST. *When it
enters the data into the worksheet, it fails to write the leave end
date.

Private Sub UserForm_Click()
*txtLastName.Value = " "
*txtLeaveStartDate.Value = " "
*txtLeaveEndDate.Value = " "
*txtLastName.SetFocus

End Sub

Private Sub cmdOK_Click()
* * ActiveWorkbook.Sheets("Leave Request").Activate
* * Range("D1").Select
* * Do
* * If IsEmpty(ActiveCell) = False Then
* * * * ActiveCell.Offset(1, 0).Select
* * End If
* * Loop Until IsEmpty(ActiveCell) = True
* * ActiveCell.Value = txtLastName.Value
* * ActiveCell.Offset(0, 1) = txtLeaveStartDate.Value
* * ActiveCell.Offset(0, 3) = txtLeaveEndDate.Value

End Sub
Private Sub cmdAdd_Click()
* * Call UserForm_Click
End Sub

Private Sub cmdCancel_Click()
* * Unload Me
End Sub

Private Sub cmdClearForm_Click()
* * Call UserForm_Click
End Sub- Hide quoted text -

- Show quoted text


Thanks to everyone who helped me. I think I figured it out...I did
not name the text box "txtLeaveEndDate". It is fixed and working
now. One last thing though, is there a quick way to have this
worksheet protected but to unprotect it when OK is clicked and then
add protection again once the information is written into the
worksheet.