DW Faisalabad New Version

DW Faisalabad New Version
Please Jump to New Version

Monday, 10 July 2017

Loop through Books and Sheets

Below we will look at a program in Excel VBA that loops through all open workbooks and worksheets, and displays all the names.

Situation:



Add the following code lines to the command button:

1. First, we declare two objects and one variable. One object of type Workbook we call book, one object of type Worksheet we call sheet, and a variable of type String we call text.



10. Test the program. Before you click on the command button, give your worksheets some descriptive names and open another blank workbook.
Result:

.