Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd guess that you spelled production differently in the worksheet tab or in the
code. You spelled production incorrectly in your code, but that doesn't matter if it actually matched what you see in the worksheet tab. That run-time error 9 says that they don't match. mrvento wrote: Thanks that helped!!! Now I am getting an error stating "Run-Tine error '9': Subscript out of range end or debug on the "Set ws = Worksheets ("ECSProducitonLog") UGGGG!!!! "Dave Peterson" wrote: Me doesn't refer to the userform that's "active". Me refers to the userform that owns the code. But I agree with you. I think the textbox belongs to the same userform as the commandbutton that is associated with the code. I'd look for typos in the name of the control or in the code. Neptune Dinosaur wrote: If the name of the text box is spelt correctly, than maybe the problem is in the rec ogntion of the user form that it lives on (it's hard to see where else it could be ....). Try spelling it out explicitly instead of using "Me" (e.g. try "MyForm.txtName.text"). Using "Me" certainly wouldn't work if the form that contains the target textbox is not the Active one at the time. -- Time is just the thing that keeps everything from happening all at once "Dave Peterson" wrote: I don't think this will make a difference. Neptune Dinosaur wrote: You should be using "Trim(Me.txtName.Text)" instead of "Trim(Me.txtName.Value)" (.Value is applicable to Cells, not text boxes) -- Time is just the thing that keeps everything from happening all at once "mrvento" wrote: Hi All, I am in need of some help!!! I created a userform using VBA, however, my value seems to be incorrect. i tried everything and nothing seems to work. This is what I have: Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("ECSProductionLog") 'find first empty row in database iRow = ws.Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0).Row 'check for a Name If Trim(Me.txtName.Value) = "" Then <<<this is were my problems is Me.txtName.SetFocus MsgBox "Please enter a name" Exit Sub End If 'copy the data to the database ws.Cells(iRow, 9).Value = Me.txtName.Value ws.Cells(iRow, 1).Value = Me.txtDailyProductionFrontEnd.Value ws.Cells(iRow, 2).Value = Me.txtDailyProductionBackEnd.Value ws.Cells(iRow, 3).Value = Me.txtMeeting.Value ws.Cells(iRow, 4).Value = Me.txtHoliday.Value ws.Cells(iRow, 5).Value = Me.txtVacation.Value ws.Cells(iRow, 6).Value = Me.txtPersonal.Value ws.Cells(iRow, 7).Value = Me.txtSick.Value ws.Cells(iRow, 8).Value = Me.txtOther.Value 'clear the data Me.txtName = "" Me.txtDailyProductionFrontEnd.Value = "" Me.txtDailyProductionBackEnd.Value = "" Me.txtMeeting.Value = "" Me.txtHoliday.Value = "" Me.txtVacation.Value = "" Me.txtPersonal.Value = "" Me.txtSick.Value = "" Me.txtOther.Value = "" Me.txtName.SetFocus End Sub -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Date field in user form & Loading a user form on opening workbook | Excel Programming | |||
Call user form from ThisWorkbook; close file if form closed | Excel Programming | |||
Automatically add a textbox to a user form based on user requireme | Excel Programming | |||
User form ComboBox Items: Remember user entries? | Excel Programming | |||
How to: User Form to assign a user defined range to a macro variab | Excel Programming |