ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula - Time, Cell (https://www.excelbanter.com/excel-programming/322407-formula-time-cell.html)

Rich

Formula - Time, Cell
 
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




Jim Thomlinson[_3_]

Formula - Time, Cell
 
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

"Rich" wrote:

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




Rich

Formula - Time, Cell
 
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!











"Jim Thomlinson" wrote:

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

"Rich" wrote:

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




Jim Thomlinson[_3_]

Formula - Time, Cell
 
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...
"Rich" wrote:

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!











"Jim Thomlinson" wrote:

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

"Rich" wrote:

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




Tom Ogilvy

Formula - Time, Cell
 
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?

--
Regards,
Tom Ogilvy


"Rich" wrote in message
...
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!











"Jim Thomlinson" wrote:

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

"Rich" wrote:

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







All times are GMT +1. The time now is 10:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com