Go to first empty worksheet in a certain group of sheets

  • Thread starter Thread starter Roger
  • Start date Start date
R

Roger

Hello All,

I have a group of 10 worksheets hidden in a Workbook. I’m looking for a
Macro to find the first empty sheet in that 10 page hidden group. Each sheet
in the group is named “T†with a number next to the T (i.e. T1, T2,T3,
T4…….etc).

The criteria for the page being empty is based on cell A1 being empty.

Any thoughts would be greatly appreciated.

Thank you – Roger
 
Hello Roger
Sub FindFirstEmpty()
Dim sh As Worksheet
Dim i As Integer
For i = 1 To 10
If Worksheets("T" & i).Range("A1") = "" Then
MsgBox "First empty cell found in sheet T" & i
Exit For
End If
Next i
End Sub
 
Thank you Papou - works great!

Roger

papou said:
Hello Roger
Sub FindFirstEmpty()
Dim sh As Worksheet
Dim i As Integer
For i = 1 To 10
If Worksheets("T" & i).Range("A1") = "" Then
MsgBox "First empty cell found in sheet T" & i
Exit For
End If
Next i
End Sub
 
One last question. Is there a way to select and go to that sheet vs. a
message box?

Thanks - Roger
 
Hi Roger

Sub FindFirstEmpty()
Dim sh As Worksheet
Dim i As Integer
For i = 1 To 10
If Worksheets("T" & i).Range("A1") = "" Then
Worksheets("T" & i).Activate
Exit For
End If

HTH
Cordially
Pascal
 
Back
Top