Auto insert time in a cell when a value is placed in front of another cell

earthworm

Well-known Member
Joined
May 19, 2009
Messages
773
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi all,

is there anyway i can insert the current time as soon as i enter the data in front of call

like cell

A1 Time()
B1 ABCDEF

there must be some way to do that , i want the time to be picked from running system .
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Not a finalized answer, but I have this for you for now. The downside to it is that whenever any cell is clicked on (changed) it updates the time.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Sheet3.Range("B1") <> "" Then
        Sheet3.Range("A1") = Time
    Else: Sheet3.Range("A1") = ""
    End If
End Sub

Or you can do it this way, but just entering the text doesnt input the time, you have to actually click on the cell (b1) to get it to work.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address = "$B$1" Then
        If Sheet3.Range("B1") <> "" Then
            Sheet3.Range("A1") = Time
        Else: Sheet3.Range("A1") = ""
        End If
    Else: End If
End Sub

This should at least get you started until someone can chime in and correct what I am missing. And I know formulas even less than I know VBA (which is very little) so there is a good possibility it could be done by formula... in which your guess is as good as mine.. lol.
 
Upvote 0
vba not working , anyone please help with respect to formula
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,865
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top