kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
Greetings to you all,
I have this piece of code here that I need to understand properly so that I don't end up misusing it during my implementation.
I have 5 worksheets that I will like to loop through and do something afterwards.
They are having the same layout and might have equal rows of data or different rows of data.
Now my questions:
1. How is the code executing? Does it run any code under the first condition against all the 5 sheets?
2. If say, I have this line
under the case statement, will it record for the first sheet the to the last sheet?
3. Assuming that I want to use real sheet names (actual sheet names) instead of their code names, how should that one be?
Thanks for your time.
Have a wonderful moment.
I have this piece of code here that I need to understand properly so that I don't end up misusing it during my implementation.
I have 5 worksheets that I will like to loop through and do something afterwards.
They are having the same layout and might have equal rows of data or different rows of data.
Now my questions:
1. How is the code executing? Does it run any code under the first condition against all the 5 sheets?
2. If say, I have this line
Code:
lr = sht.cells(Rows.Count, "A").End (xlUp).Row
3. Assuming that I want to use real sheet names (actual sheet names) instead of their code names, how should that one be?
Code:
Dim sht As Worksheet
For Each sht In Worksheets
Select Case sht.CodeName
Case "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5"
Case Else
End Select
Next sht
Thanks for your time.
Have a wonderful moment.