VBA multiple events

R

Rachel

I am attempting to create a workbook to use as a patient log, entering the
admission date into Column A, admission time into Column B, patient name
etc..into the following columns, with patient discharge time entered into
Column P. I am using a code for date and time entry that will allow me to 10
key the numbers and they will auto format. I however, have been unsuccessful
in combining the codes so address the two issues: one being date and time
change and the changes being made in multiple columns. Any help would be
appreciated.

Thanks
 
C

Chip Pearson

If you are using the code on my site at
www.cpearson.com/Excel/DateTimeEntry.htm, you can modify the code as shown
below:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then
Exit Sub
End If
On Error GoTo ExitSub:
Application.EnableEvents = False
If Target.Column = 1 Then ' column A
'''''''''''''''''''''''''''''
' code for short date entry
'''''''''''''''''''''''''''''
ElseIf (Target.Column = 2) Or _
(Target.Column = 16) Then ' column B or P
'''''''''''''''''''''''''''''
' code for short time entry
'''''''''''''''''''''''''''''
End If
ExitSub:
Application.EnableEvents = True
End Sub

This will allow for quick date entry in column A and quick time entry in
columns B and P.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
R

Rachel

Chip,

As you know I am using the code on from you website and despite my attempts
and anothers (who is Excel savvy) we have been unable to get the below code
and the codes from your website to work. Your feedback is appreciated.

Rachel
 

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

Top