Timestamp without Worksheet_Change

sassriverrat

Well-known Member
Joined
Oct 4, 2018
Messages
655
Hello-

Trying to figure out how to do a timestamp that can be embedded within a macro (so I don't have to copy it to every sheet). Here's the coding I was running as a Worksheet_Change

thanks

Code:
Private Sub Worksheet_Change(ByVal Target As Range)    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End If
    
    If Not Intersect(Target, Range("R8,W25")) Is Nothing Then
        
        If Cells(8, 18) <> "" And Cells(25, 23) = "" Then
            Cells(4, 6) = Date
            Cells(4, 6).NumberFormat = "dd-mmm-yyy"
        End If


        If Cells(25, 23) <> "" Then
            Cells(4, 6) = Cells(25, 23).Value
            Cells(4, 6).NumberFormat = "dd-mmm-yyy"
        End If
        
          If Cells(8, 18) = "" And Cells(25, 23) = "" Then
            Cells(4, 6) = "No Data Input"
        End If



        With Application
            .EnableEvents = True
            .ScreenUpdating = True
        End With


    End If
End Sub
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
try the following codes
Code:
Sub sassri()
For a = 1 To Sheets.count
    Sheets(a).Cells(4, 6).NumberFormat = "dd-mmm-yyy"
    If Sheets(a).Cells(8, 18) <> "" Then
        If Sheets(a).Cells(25, 23) <> "" Then
        Sheets(a).Cells(4, 6) = Cells(25, 23).Value
        Else
        Sheets(a).Cells(4, 6) = Date
        End If
    Sheets(a).Cells(4, 6) = "No data found"
    End If
    MsgBox "updated"
End Sub
run the macro on a copy of your workbook and ensure it is working the way you want.
ravishankar
 
Upvote 0
Hello,

Do not forget you can always use events at the WorkBook level ... which will take care of all your sheets ... with your single macro ...:wink:
 
Upvote 0
So thoughts here gentlemen- and sorry for the time delay here-
@ravishankar - I added a "next" right before the msgbox to satisfy the code and allow the macro to run. However, it didn't give me any results...not sure why though. I set my code to call your macro at the end of my formatting macro.
@James006 - As an alternative idea to Ravishankar, so I probably did it wrong but i changed my code to start with a "Sub Workbook_Change(ByVal Target As Range)" and it didn't work.

Additionally, I'd like this to work for Noon, Noon2, Noon3, etc (infinitely) as well as the "Arrival" sheet. I have a few other sheets in the workbook (like "Notes") that it needs to not affect.

Thanks Guys!
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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