Formula - Time, Cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I am having a hard time trying to figure out how to do the following

Basically I have an excel sheet with several columns.
Coloumn A = Account Number
Coloumn B = Time

I would like to have some sort of formula that automaticall enters the time
(only the time of day) in (b2) when they enter an account number in cell (a2)

I tried making a macro but it was not working properly can anyone PLEASE help
Thanks in Advance
-Rich
 
Here is the macro you need. You need to paste this into the code for the
sheet you want. In Excel Right Click on the tab where you want this to
happen. Select View Code. Paste this code into the window.

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Row > 1 And Target.Column = 1 Then
Target.Offset(0, 1).Value = Time
End If
End Sub

This returns only the current system time. If you want it to be the current
date and time change the word time to now in the code.

HTH
 
JIm THanks for the help but maybe i did not explain myself well.

What i have is a spreadsheet with 7 coloumns and 30 rows
Column B is "Account Number"
Column C is "Time"

Each time someone enters an account # into Coulumn B I want to generate the
exact time in Column C

And I need to have it do this for each of the 30 rows.

Hope this is easier to understand..and again, thanks!
 
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Row > 1 And Target.Row < 31 And Target.Column = 2 Then
Target.Offset(0, 1).Value = Time
End If
End Sub

This code will do the following.
If you change a value in Column B between rows 2 through 30, then in column
C it will add the current time right beside the account that you just changed.

By changing the 1, 31 and 2 you can change how this works. I hope this is
what you are looking for...
 
That's pretty much what his code does except it works for entries in column
B on all rows but row 1. What do you think it does?
 

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