Inputting user ID and datestamp in cell when checkbox is ticked

L

Legacy 347657

Guest
Hi

I currently have a macro that automatically inputs a users name/ID and a datestamp in a cell (Column K) when a checkbox in column J is ticked. I've added the VBA text below for reference (this includes script to unlock and lock the worksheet as well as it is a password protected file).

This is a very useful macro, however I would like to add the following functions and am wondering if someone can help me.

  • How do I change this so that the macro works with an ActiveX checkbox (rather than a form checkbox) - so the checkboxes can be moved and sized with cells, so I can use filters etc?
  • Can I add to this macro so that when the checkbox is ticked, whatever is in column F is copied and value-pasted into column L?
  • Can I add another checkbox (to column H) - so there are more than checkbox in a row - that puts username and datestamp in column I when ticked?

Here's the text - thanks very much in advance for any help!

Sub Process_CheckBox()


Dim cBox As CheckBox
Dim LRow As Integer
Dim LRange As String


LName = Application.Caller
Set cBox = ActiveSheet.CheckBoxes(LName)


ActiveSheet.Unprotect Password:="signoff"


'Find row that checkbox resides in
LRow = cBox.TopLeftCell.Row
LRange = "K" & CStr(LRow)


'Change date in column K, if checkbox is checked
If cBox.Value > 0 Then
ActiveSheet.Range(LRange).Value = Application.UserName & " " & Date


ActiveSheet.Protect Password:="signoff"


'Clear date in column K, if checkbox is unchecked
Else
ActiveSheet.Range(LRange).Value = Null

ActiveSheet.Protect Password:="signoff"

End If


End Sub
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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