help i need to add a combo box to a form


New Member
Sep 13, 2009
I need some help. I need to add a combo box to a form. When I make a selection in the combo box and add the Info to my form it goes to the truck I select. But if I don’t enter Data in then text box it will delete my data off my sheet. And one more thing I need to enter it on a different sheet. So when I select the truck in the combo box and enter the data in. It will go to PM_SUMMARY and to the truck log. There are like 50 of them. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>
sheet are 7-9301<o:p></o:p>
7-0302 <o:p></o:p>
Private Sub cmdAdd_Click()
Dim ws As Worksheet
Set ws = Worksheets("PM_SUMMARY")
'check for a date
If Trim(Me.txtDate.Value) = "" Then
MsgBox "Please enter a Date "
Exit Sub
End If
'check for a hours
If Trim(Me.txtHR.Value) = "" Then
MsgBox "Please enter a Mileage/Hours"
Exit Sub
End If
'copy the data to the database
ws.Cells(6, 10).Value = Me.txtDate.Value
ws.Cells(6, 6).Value = Me.txtDot.Value
ws.Cells(6, 14).Value = Me.txtDatePm.Value
ws.Cells(6, 12).Value = Me.txtHR.Value
ws.Cells(6, 16).Value = Me.txtPm.Value
Unload Me
End Sub
Private Sub txtDate_Change()
Me.txtDate.Value = Date
End Sub
Ok a lot of it lol

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...