Take this out.
Private Sub UserForm_Click()
UserForm.Show
End Sub
Regards
Derek +++
>________________________________
> From: JIM NEELY <jimneely@yahoo.com>
>To: "ExcelVBA@yahoogroups.com" <ExcelVBA@yahoogroups.com>
>Sent: Monday, 19 March 2012, 18:59
>Subject: Re: [ExcelVBA] Re: Error in User form
>
>
>
>Maybe this will help. Here is my whole code for the Userform. Hope this will give you an idea as to why i can click out side any box and get an error.
>
>Private Sub CancelCommandButton_Click()
>Sheets(1).Activate
>Unload Me
>End Sub
>Private Sub ClearCommandButton_Click()
>Call UserForm_Initialize
>End Sub
>Private Sub OkayCommandButton_Click()
>Dim emptyRow As Long
>'Make Sheet1 Active
>Application.ScreenUpdating = False
>Sheets(2).Activate
>'Determine emptyRow
>emptyRow = WorksheetFunction.CountA(Range("B:B")) + 1
>
>'Export Data to worksheet
>Cells(emptyRow, 1).Value = Now()
>Cells(emptyRow, 2).Value = DeptListBox.Value
>Cells(emptyRow, 3).Value = LineListBox.Value
>Cells(emptyRow, 4).Value = MachineListBox.Value
>Cells(emptyRow, 5).Value = PartNTextBox.Value
>Cells(emptyRow, 6).Value = OldSNTextBox.Value
>Cells(emptyRow, 7).Value = NewSNTextBox.Value
>Cells(emptyRow, 8).Value = ProblemTextBox.Value
>Cells(emptyRow, 9).Value = SolutionTextBox.Value
>Cells(emptyRow, 10).Value = CauseListBox.Value
>Cells(emptyRow, 11).Value = ActionListBox.Value
>Call UserForm_Initialize
>End Sub
>Private Sub UserForm_Click()
>UserForm.Show
>End Sub
>Private Sub UserForm_Initialize()
>DeptListBox.Clear
>With DeptListBox
> .AddItem "M200"
> .AddItem "B800"
> .AddItem "B700"
> .AddItem "423K"
> .AddItem "143K"
> .AddItem "481K"
> .AddItem "Tool Room"
> .AddItem "Maintenance"
> .AddItem "Investigation"
>End With
>LineListBox.Clear
>With LineListBox
> .AddItem "Oil Pump"
> .AddItem "Drum"
> .AddItem "Gear"
> .AddItem "ASSY"
> .AddItem "Case"
> .AddItem "T/C"
> .AddItem "V/B"
> .AddItem "D"
> .AddItem "Press"
> .AddItem "Main Line"
> .AddItem "Sub Line"
> .AddItem "Brazing"
> .AddItem "Heat Treat"
> .AddItem "Kaizen"
>End With
>MachineListBox.Clear
>With MachineListBox
> .AddItem "Machine"
> .AddItem "Station"
>End With
>CauseListBox.Clear
>With CauseListBox
> .AddItem "Wear"
> .AddItem "Abuse"
> .AddItem "Lost"
>End With
>ActionListBox.Clear
>With ActionListBox
> .AddItem "Replace"
> .AddItem "Repair"
>End With
>PartNTextBox.Value = ""
>OldSNTextBox = "N/A"
>NewSNTextBox = "N/A"
>SolutionTextBox = ""
>ProblemTextBox = ""
>'Set Focus on DeptTextBox
>DeptListBox.SetFocus
>End Sub
>
>[Non-text portions of this message have been removed]
>
>
>
>
>
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar