PDA

View Full Version : [SOLVED] Trying to place values in a sheet



MUSASHI
11-05-2004, 10:44 AM
I zipped up a lil file...its messy, not cleaned up yet, but a "working" copy...

EDITED

Revised, can somebody look at my frm_ViewEmp userform code. The data selected each time from the list on that form will vary each time....may be 1 or 2 items may be as many as 6-7 items. I tried to emulate the code from the other userform, but obviously missing something...:bawl

Sorry to be persistent, last major hump.

Thx

MUSASHI
11-06-2004, 09:22 AM
Andy form Oz Board helped me out with this code



Private Sub cb_EmpExit_Click()
Dim LastRow As Long
Dim intCol As Integer
Dim intIndex As Integer
'make sure employee number is entered
Select Case tbTrainDate.Text
Case Is = "Required!"
MsgBox "Sorry, but you must enter a date from the Calendar! "
Exit Sub
Case Else
'do nothing
End Select
With Worksheets("Records")
LastRow = .Range("A65536").End(xlUp).Row + 1
.Cells(LastRow, 1).Value = tbTrainDate.Value
' Store values from listbox1 columns
.Cells(LastRow, 2).Value = ListBox1.List(ListBox1.ListIndex, 0)
.Cells(LastRow, 3).Value = ListBox1.List(ListBox1.ListIndex, 1)
.Cells(LastRow, 4).Value = ListBox1.List(ListBox1.ListIndex, 2)
' store option button choice
If Me.obMedical Then .Cells(LastRow, 5) = 1
If Me.obCSC Then .Cells(LastRow, 5) = 2
If Me.obCraft Then .Cells(LastRow, 5) = 3
If Me.obEquipment Then .Cells(LastRow, 5) = 4
' store selected items from listbox2
intCol = 6
For intIndex = 0 To ListBox2.ListCount - 1
If ListBox2.Selected(intIndex) Then
.Cells(LastRow, intCol).Value = ListBox2.List(intIndex)
intCol = intCol + 1
End If
Next
End With
Unload Me
End Sub
fyi,

Thanks
Mus