Please help with formula or VBA

greenadam1986

New Member
Joined
Dec 23, 2019
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello i am trying to use a checkbox to add the current time in one cell and then add a number to another cell.

e.g. cell (B1) 10:31am - cell (C1) 1

then if i untick the checkbox, ti is clear.

can anyone please help.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Assuming it is an active X check box. Create the checkbox and right click and select view code

VBA Code:
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then Range("B1").Value = Time()
If CheckBox1.Value = True Then Range("C1") = 1

If CheckBox1.Value = False Then Range("B1").ClearContents
If CheckBox1.Value = False Then Range("C1").ClearContents
End Sub
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,639
Members
449,093
Latest member
Ahmad123098

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