![]() |
VBA multiple events
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 |
VBA multiple events
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) "Rachel" wrote in message ... 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 |
VBA multiple events
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 "Chip Pearson" wrote: 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) "Rachel" wrote in message ... 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 |
All times are GMT +1. The time now is 12:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com