エクセル、空っぽのシートを見つける
・すべてのシートをナメて、空のシートを見つけたい
・UsedRangeで、行・列いずれかが1でないものは、空ではない(はず)
・UsedRangeで、行・列いずれも1で、かつ、セル(1,1)が空なら、空のはず
・画像などが一つもない(Shapes.Count = 0)なら空のはず
という条件にしてます。
sample.bas
Sub 空っぽのシートを見つける()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim sht As Variant
For Each sht In ActiveWorkbook.Sheets
If sht.Visible <> xlSheetHidden Then
sht.Select
'Debug.Print sht.Name
shtnm = sht.Name
r = Sheets(shtnm).UsedRange.Cells(ActiveSheet.UsedRange.Count).Row
c = Sheets(shtnm).UsedRange.Cells(ActiveSheet.UsedRange.Count).Column
If r = 1 And c = 1 And _
Sheets(shtnm).Cells(r, c).value & "" = "" And _
Sheets(shtnm).Shapes.Count = 0 Then
Debug.Print shtnm & " is Null"
Else
Debug.Print shtnm & " is not Null"
End If
'Sheets(shtnm). と sht. どっちでも動く
End If
Next
'ActiveWorkbook.Sheets(1).Select
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
※参考
【エクセル】全シートのカーソルを左上にそろえる #ジョーク
https://qiita.com/santarou6/items/b4a556a49d1c5b7960e4