Thread: FOR MIKE H.
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Sean Timmons Sean Timmons is offline
external usenet poster
 
Posts: 1,696
Default FOR MIKE H.

This will depend on where your other cells are. If all in the same row, use:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Column
Case 5, 6, 8
If Target.Row = 4 Then
If IsEmpty(Target) Then Target.Value = Time
End If
End Select
End Sub

Which will enter the time if you are in cells E4, F4 OR H4.

If in the same column, reverse where I have Column and Row in the above.

If in a mixture of both, use multiple Case statements..

Case 4
If x Then Y
Case 8
If a Then B
etc.
End Select

"doss04" wrote:

That worked, i just cant get it to work on other cells. How do i do multiple
cells through out the worksheet?

"Sean Timmons" wrote:

Here's the previous post....
Answer from Mike H on top, initial post on bottom, but I believe it only
needs a simple addition, see below.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 5 AND Target.Row = 4 Then
If IsEmpty(Target) Then Target.Value = Time
End If
End Sub

Assuming you want to click in cell E4

________________________________________
Hi,

It colud be done like this. Right click your sheet tab, view code and paste
this in on the right. Change the 5 (Column E) to the appropriate column. It
can be written so that this only happens in certain cells and if you need
more help post back.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 5 Then
If IsEmpty(Target) Then Target.Value = Time
End If
End Sub

Mike

"doss04" wrote:

I know the question has been asked and the simple answer is ctrl - shift - :
to add time in a cell. Unfortunatly sometimes the easy solution is still
difficult. I would like to know how to click on a cell and have the time
appear. Because i do security patrols and my laptop is mounted in my vehicle.
It"s difficult to type unless i stop to look at the keyboard and it's still
typing with one hand. If anyone is willing to tell that would be great. I am
new to excel and i am willing for trial and error. Thanks



"Bob Phillips" wrote:

Post the code and give us a chance.

--
__________________________________
HTH

Bob

"doss04" wrote in message
...
I apologize for contacting you this way. But once i replied that my last
post
was answered i didn't think you would check it again. You helped me with
the
clicking a cell and having the time appear. Well i have another question
regarding that. The formula you gave works great by the way. Now I'm
trying
to do individual cells. I've tried working around it myself, but all i get
is
either the entire column or row gets formatted. Not the cells i'm trying.
Could you help again? Thanks