macro run log

mani_singh

Well-known Member
Joined
Jul 24, 2007
Messages
583
hi everyone - what ihave is a page called "log"

on this i need a two column table

in colA = date / time of macro run
in colB = successfull or failed - depending on if the macro finished or not

it must log and prepare for the next row or data entry the next time the macro is run

NOTE: the macro is singular i.e. one main macro to do everything in the service.

any ideas on how to get this done? :confused: :biggrin:
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi

In your existing code, assuming you are using error handling, you would incorporate the result like this:

Code:
'Your existing variable declarations

Dim NextRow As Long
NextRow = Worksheets("log").Range("A65536").End(xlUp).Row + 1
Worksheets("log").Cells(NextRow, 1).Value = Format(Now(), "General Date")

On Error GoTo Error_Handler

'Your existing code
'  "      "      "
'  "      "      "
'  "      "      "
'  "      "      "
'  "      "      "
'  "      "      "
'  "      "      "
'  "      "      "
'  "      "      "
'  "      "      "
'  "      "      "
'  "      "      "
Worksheets("log").Cells(NextRow, 2).Value = "Successful"

Exit_Here:
    Exit Sub

Error_Handler:
    MsgBox Err.Description, vbCritical, "Error # " & Err.Number
    Worksheets("log").Cells(NextRow, 2).Value = "Failed"
    GoTo Exit_Here
    
End Sub

I don't expect you will be able to drop this code directly into your routine but hopefully it gets you started in the right direction.

Andrew
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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