Excel VBA UserID help

MichaelSFG

New Member
Joined
Apr 25, 2012
Messages
2
Hello,

I am trying to create a worksheet for project approval. My current formula has it when a checkbox is clicked, it displays time and a message. I would like the message (now "complete") to display the user id associated with the individual that clicks on the box. Here is what I have so far

Private Sub CheckBox10_Click()
Dim LR As Long
LR = Range("L" & Rows.Count).End(xlUp).Row + 10
If LR < 3 Then LR = 3
If CheckBox10 Then Range("J" & LR) = Now & " - Complete"
End Sub

Is it is as simple as changing the "Complete" to some userid formula? I tried "Environ("Username") and kept getting error messages "Compile Error: Expected: end of statement"

Thanks,
Michael
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You basically said it. Not sure why you are getting an error but try this.

Code:
Private Sub CheckBox10_Click()
Dim LR As Long
LR = Range("L" & Rows.Count).End(xlUp).Row + 10
If LR < 3 Then LR = 3
If CheckBox10 Then Range("J" & LR) = Now & " " & Environ("Username")
End Sub
 
Upvote 0
Maybe

If CheckBox10 Then Range("J" & LR) = Now & " - " & Environ("Username")

M.
 
Upvote 0
"= Now & " " & Environ("Username")"

That fixed it. Thanks! This was driving me nuts for about an hour.
Appreciate the help all!
 
Upvote 0

Forum statistics

Threads
1,215,331
Messages
6,124,311
Members
449,152
Latest member
PressEscape

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