An issue of time

KTunstall

New Member
Joined
Feb 14, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Long time lurker, first time poster.

I have looked on this forum (and others) for an answer to no avail.

I have a workbook that logs time(s) through user interaction (either CTRL+SHFT+Colon or a double click on a cell).
The times are logging events (in my case, objections and the inclusion of exhibits).
The log entries are non-contiguous as well (multi-column and hundreds of rows).
Whenever a user changes a cell on the Log, I want the time to fire on the hidden time tab.

To simplify (and bifurcate) the example, let's assume I have two tabs in the workbook.
The first tab is called "Log" and the second tab is called "time"

In say A2-A10, A12-A20, A22-30, etc., etc., the user will place a numeric value (exhibit number or letter).
When they perform this task, I want the following to happen on the "time" tab.

Again in A2-A10, A12-A20, A22-A30, etc., etc., I need the exhibit number (or letter) to be noted. (this is easy).
However, upon that instance being triggered, in the next column I need the time to fire.
I will need to further utilize those times in other calculations and for reporting purposes.

I am not afraid of VBA, and I do not want to use a circular formula.
Looking for suggestions.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Lets get this clear, is the below what you mean....
  1. The user enters a number or letter in a cell in one of the ranges that you mentioned (from now on I am going to use A3 for this) on the log sheet.
  2. On the Time sheet the same entry is to appear in cell A3
  3. On the Time sheet a Time stamp is to appear in cell B3
If the above is correct should the Time stamp be just time or date and time?
 
Upvote 0
I used a simple formula to bring over the exhibit info
Code:
=IF('Log'!A3<>"",'Log'!A3,"")
That part is easy.

I can't use Now() as those values will change every time the workbook is opened.
Looking for a simple yet elegant solution. Heh.
 
Upvote 0
Don't worry about the formula we'll bring it all over in the macro.
 
Upvote 0
Try putting the code below in the worksheet module of the "Log" sheet (Right click the sheet tab,click view code and paste in the window that appears) and test.
Format column B in the Time sheet how you wish.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Range("A2:A10, A12:A20, A22:A30")) Is Nothing And Target.Cells.Count = 1 Then
    
    Application.EnableEvents = False
        Sheets("Time").Cells(Target.Row, Target.Column) = Target.Value
        Sheets("Time").Cells(Target.Row, Target.Column + 1) = Time
    Application.EnableEvents = True
    
    End If
    
End Sub
 
Upvote 0
Didn't seem to work.
I will clarify further that my actual entry location for the exhibit identifier is on A167-A191 and G167-G191.
The location for the entry on my "time" tab is A418 and C418.
I'll address the second column after the first column works.
Should have been more clear about multi-column.

I have attached an image of each.

So
Code:
Application.EnableEvents = False
        Sheets("Times2").Cells(Target.Row + 251, Target.Column) = Target.Value
        Sheets("Time2").Cells(Target.Row + 251, Target.Column + 1) = Time
    Application.EnableEvents = True

Doesn't seem to work (with reference to the first row at least.
 

Attachments

  • Log.png
    Log.png
    45.5 KB · Views: 4
  • time.png
    time.png
    47.2 KB · Views: 4
Upvote 0
It works for me with the ranges that you quoted in your first post did that not work? If you haven't tested it with your original ranges please test with the file in the link below please (your ranges are highlighted yellow).
my actual entry location for the exhibit identifier is on A167-A191 and G167-G191.
The location for the entry on my "time" tab is A418 and C418.
The above does not match with the questions I asked in post #2 that you stated were all correct or the ranges you quoted in post number 1. .
 
Upvote 0

Forum statistics

Threads
1,216,098
Messages
6,128,812
Members
449,468
Latest member
AGreen17

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