Sub WheresmyAccount()
Dim lrow As Long, search_val As String, mainsh As Worksheet, Sh, acclrow As Long, renewal_row, iflag As Boolean
lrow = Cells(Rows.Count, 2).End(xlUp).Row
search_val = Range("a3")
Application.ScreenUpdating = 0
Application.EnableEvents = 0
If lrow > 8 Then Range("b9", Cells(lrow, 3)).ClearContents
If Range("a3") = "" Then Exit Sub
Set mainsh = Sheets("Start")
For Each Sh In ActiveWorkbook.Sheets
If InStr("GraphsStartSummary", Sh.Name) = 0 Then
If Sh.Visible = True Then
If Sh.Range("a17").EntireRow.Hidden = True Then iflag = True Else iflag = False
With Sh.Range("c16", Sh.Cells(Rows.Count, "c").End(xlUp))
.AutoFilter 1, "*" & search_val & "*"
.Offset(1).Copy mainsh.Cells(Rows.Count, 2).End(xlUp).Offset(1)
acclrow = mainsh.Cells(Rows.Count, 2).End(xlUp).Row
renewal_lrow = mainsh.Cells(Rows.Count, 3).End(xlUp).Offset(1).Row
If acclrow >= renewal_lrow Then
With mainsh.Range("c" & renewal_lrow & ":c" & acclrow)
.NumberFormat = "@"
.Value = Sh.Name
End With
End If
.AutoFilter
If iflag = True Then Sh.Range("a17").EntireRow.Hidden = True
End With
End If
End If
Next
Application.EnableEvents = 1
Application.ScreenUpdating = 1
End Sub
Bookmarks