Coding fields to a button

jrsarrat

New Member
Joined
Jul 8, 2018
Messages
47
Good day!

I have a button on my form, and this button will be linked to 2 fields: User ID and log time. In Design View, I have already filled in a Default Value of =Now() for the log time. I need assistance with linking the button to the user ID and LogTime fields? This way with a click of the button, the table will update based on the user and time in which they clicked the button.

Your help is appreciated.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
add the fields to the bottom of the data sheet:
Code:
btnAdd_click()

sheets("data").select
range("A2").select
NextFreeCell
activecell.offset(0,0).value = txtUserID
activecell.offset(0,1).value = Now()
End Sub

Public Sub NextFreeCell()
Select Case True
   Case ActiveCell.Value = ""
   Case ActiveCell.Offset(1, 0).Value = ""
       ActiveCell.Offset(1, 0).Select
   Case Else
       Selection.End(xlDown).Select
End Select
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,385
Members
448,956
Latest member
JPav

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
Back
Top