Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Most recently access/ed modified Worksheet within a Workbook

Status
Not open for further replies.

jgisler

IS-IT--Management
Feb 13, 2002
9
US
Hi,
I have a Excel workbook that consists of approx 150-200 worksheets. I used the following code to add date/time stamps to each individual worksheet within the workbook.
I would now like to create a print function that will print out only the most recent (since I last saved) changes to worksheets within the workbook. Is this possible? If so, how would I do it?

Thanks,
Jen

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
With Cell
If .Column = Range("G:G").Column Then
Cells(.Row, "F").Value = Int(Now)
End If
End With
Next Cell

End Sub
 
hi,

Here's a way...
Code:
Sub LatestSheetChange()
    Dim WbkMax, ThisMax, WksName()
    WbkMax = 0
    i = 0
    For Each Worksheet In Worksheets
        ThisMax = Application.WorksheetFunction.Max(Worksheet.Range("F:F"))
        If ThisMax > WbkMax Then
            WbkMax = ThisMax
            i = i
            ReDim WksName(i)
            WksName(i) = Worksheet.Name
        ElseIf ThisMax = WbkMax And ThisMax > 0 Then
            i = i + 1
            ReDim Preserve WksName(i)
            WksName(i) = Worksheet.Name
        Else
            'no op
        End If
    Next
    For i = LBound(WksName, 1) To UBound(WksName, 1)
        Worksheets(WksName(i)).PrintOut
   Next
End Sub
Hope this helps ;-) Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top