View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Help with Check Box and VBA

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)

"wlatif " wrote in message
...
Hi,

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

I want to create a two columns sheet in the first column I want a check
box in the next column a date field. When the user checks the check box
the current date and time would be put in the date column this way I
can tell when that task was done. If the check mark is unchecked the
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 to
attach the code to it to do the above it will be great.

Thanks.


---
Message posted from http://www.ExcelForum.com/