This function works through the sheets from right to left until it finds a non-blank sheet, and returns its name.
This function works through the sheets from right to left until it finds a non-blank sheet, and returns its name Function GetLastNonEmptySheetName() As String Dim I As Long For I = Worksheets. Count To 1 Step -1 If Sheets(i).UsedRange.Cells. Count > 1 Then GetLastNonEmptySheetName = Sheets(i).
Name Exit Function End If Next I End Function.
Thanks! I've been diving into excel VBA and learning fast I think but its different from the languages I know. – Tony Peterson Nov 11 '08 at 14:21.
The method above will ignore a sheet with a single cell entry, while that may seem to be a quibble, a Find looking for a non-blank cell will give more certainty The xlFormulas argument in the Find method will find hidden cells (but not filtered cells) whereas xlValues won't Sub FindLastSht() Dim lngCnt As Long Dim rng1 As Range Dim strSht As String With ActiveWorkbook For lngCnt = .Worksheets. Count To 1 Step -1 Set rng1 = . Sheets(lngCnt).Cells.
Find("*", , xlFormulas) If Not rng1 Is Nothing Then strSht = . Sheets(lngCnt). Name Exit For End If Next lngCnt If Len(strSht) > 0 Then MsgBox "Last used sheet in " & .
Name & " is " & strSht Else MsgBox "No data is contained in " & . Name End If End With End Sub.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.