Help with Check Box and VBA

  • Thread starter Thread starter wlatif
  • Start date Start date
W

wlatif

Hi,

I am new to excel and I am not sure if what I want is doable or not,
would really appreciate your help;

I want to create a two columns sheet in the first column I want a chec
box in the next column a date field. When the user checks the check bo
the current date and time would be put in the date column this way
can tell when that task was done. If the check mark is unchecked th
second cell needs to be cleared out if a date was there already.

If you can help me with both how to create the check box and how t
attach the code to it to do the above it will be great.

Thanks
 
Hi,

Here is a solution that doesn't use a checkbox, but does put a check mark in
the column. Just copy the code into the worksheet code module (right-click
on the sheet name tab, select View Code, and paste the code in). Try it!

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

With Target
If .Column = 1 Then
If .Value = "a" Then
.Value = ""
.Font.Name = "Arial"
.Offset(0, 1).Value = ""
Else
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Value = Format(Date, "dd mmm yyyy")
End If
.Offset(0, 1).Activate
End If
End With
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top