View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Charles Harmon Charles Harmon is offline
external usenet poster
 
Posts: 48
Default Userform Input Into Excel

Kris,

wrote in message
ups.com...
@gocush: Thanks for the effort, however my subtotals aren't typical
ones and cannot be recreated using the subtotals command. I therefore
did not play around with your code too much.

@Charles: This code works well like Tom's, however I have no idea how
to get teh check box and the combo box that is spread out over several
cells depending on entry to work. Thoughts on this?

Also, on a more important note, this macro does not insert entries in
which a month does not already exist in the database. Please remember
about the subtotals for each month when considering this problem.

My current code is as follows:
Private Sub btnOk_Click()
Dim rng As Range
Dim dt As Date
Dim rng1 As Range

'''''''''''''''''''' Added '''''''''''''
Dim i as Integer
Dim j as intenger
Dim k as integer
'''''''''''''''''''''''''''''''''''''''''''''''''' '''
Set rng1 = Nothing
Set rng = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
dt = CDate(txtdate.Text)
For Each cell In rng
If IsDate(cell) Then
If cell.Value = dt Then
MsgBox "Date already exist"
ElseIf cell.Offset(1, 0).Value dt Then
cell.Offset(1, 0).EntireRow.Insert
Set rng1 = cell.Offset(1, 0)
Exit For
End If
End If
Next
If Not rng1 Is Nothing Then
With frmLaSalleOutage
rng1(,1).Value = .txtdate.Text<<<<<<<<< Corrected to show range

location
rng1(, 2).Value = .txtstart.Text
rng1(, 3).Value = .txtduration.Text
rng1(, 4).Value = .txtresponse.Text
rng1(, 5).Value = .txtarrived.Text
rng1(, 6).Value = .txtcause.Text
rng1(, 7).Value = .txtcustomers.Text
rng1(, 8).Value = .txtlocation.Text
rng1(, 9).Value = .txtequipment.Text

''''''''''''''''''''''''''' Added
'''''''''''''''''''''''''''''''''''''''''''''
If .chkfollow.Value = True Then
rng1(, 16).Value = "What?"<<<<< you need to supply info not sure
what you wanted
End If
For i = 0 To .ComboKelcom.ListCount - 1
If .ComboKelcom.Selected(i) Then
rng1(, 21).Value = .ComboKelcom.List(i)
End If
Next
For k = 0 To .ComboOEB.ListCount - 1
If .ComboOEB.Selected(k) Then
rng1(, 22).Value = .ComboOEB.List(k)
End If
Next
For j = 0 To .comboFeeder.ListCount - 1
If .comboFeeder.Selected(j) Then
rng1(, 10).Value = .comboFeeder.List(j)
rng1(, 11).Value = .comboFeeder.List(j)
rng1(, 12).Value = .comboFeeder.List(j)
rng1(, 13).Value = .comboFeeder.List(j)
rng1(, 14).Value = .comboFeeder.List(j)
End If
Next
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
End With
End If
Unload Me
End Sub

Thanks,

Kris Taylor
www.QuestOfAges.org Administrator