How to loop through each sheet in Excel workbook using Excel VBA

preview_player
Показать описание
Title: How to loop through each sheet in Excel workbook using Excel VBA

Recommended Excel VBA books
===================================================
====================================================

In this video, you'll learn how to loop through each sheet in excel workbook using Excel VBA. Launch new Excel workbook go to developer tab - Visual basic- Insert a Module. Create a new sub routine and name it as loop_sheets and enter the below code

==========================================

Sub loop_sheets()
Set shts = ThisWorkbook.Sheets

Dim count As Integer

For i = 1 To count
Debug.Print ThisWorkbook.Sheets(i).Name
Next i

For Each sht In shts
If sht.Range("A1") = "TXT" Then
Debug.Print sht.Name
End If

Next

End Sub

=======================================

Рекомендации по теме
Комментарии
Автор

What if one needs to exempt a sheet from being among your loop?

nosaosaghae
welcome to shbcf.ru