automatic entry of data into a data entry form new

Grahamscown

New Member
Joined
Feb 26, 2014
Messages
35
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Mobile
is there a way to auto populate fields in a data entry form like seen below i would like to enter just the name and have the rego and company auto populate from a list and time . date , month and week auto populate at the same time of entry
 

Attachments

  • data entry form.JPG
    data entry form.JPG
    88.4 KB · Views: 7

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Grahamscown

New Member
Joined
Feb 26, 2014
Messages
35
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Mobile
VBA Code:
Private Sub cmdClose_Click()
  Unload Me
End Sub

Private Sub cmddate_Click()

Call txtdate_Change

End Sub

Private Sub cmdenter_Click()

Dim RowCount As Long

RowCount = Worksheets("Sheet1").Range("A1").CurrentRegion.Rows.Count
With Worksheets("Sheet1").Range("A1")
.Offset(RowCount, 0) = Format(Now(), "HH:MM:SS AM/PM")
.Offset(RowCount, 1) = Me.txtname.Value
.Offset(RowCount, 2) = Application.VLookup(Me.txtname.Value, Sheet2.Range("A:B"), 2, False)
.Offset(RowCount, 3) = Application.VLookup(Me.txtname.Value, Sheet2.Range("A:C"), 3, False)
.Offset(RowCount, 4) = Date
.Offset(RowCount, 5) = Me.txtmonth.Value
.Offset(RowCount, 6) = Me.txtweek.Value

End With

  
End Sub

Private Sub cmdtime_Click()
 
 Call txttime_Change

End Sub

Private Sub txtcompany_Change()

End Sub

Private Sub txtdate_Change()

txtdate.Value = Date

End Sub

Private Sub txtmonth_Change()

End Sub

Private Sub txtname_Change()

End Sub

Private Sub txtrego_Change()

End Sub

Private Sub txttime_Change()

txttime.Value = Time

End Sub

Private Sub txtweek_Change()

End Sub

Private Sub UserForm_Click()

End Sub
ok i have a working script now but i want to change the text box for name into a dropdown to avoid spelling mistakes
 

Attachments

  • Capture 2.JPG
    Capture 2.JPG
    107.2 KB · Views: 2
Last edited by a moderator:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,562
Office Version
  1. 365
Platform
  1. Windows
You can populate a combo like
VBA Code:
Private Sub UserForm_Initialize()

   With Sheet2.Range("A2", Sheet2.Range("A" & Rows.Count).End(xlUp))
      Me.ComboBox1.List = .Value
   End With
End Sub
 

Forum statistics

Threads
1,141,707
Messages
5,707,980
Members
421,539
Latest member
zuniBM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top