cacahuatitaCH
New Member
- Joined
- Jan 8, 2021
- Messages
- 12
- Office Version
- 365
- Platform
- Windows
I am trying to make a code that will:
I would be eternally grateful if someone would help out. I understand I am asking for basically the whole thing, but I have erased so many attempts I lost hope.
- Check if value on B2 is "Cup" or "Glass"
- Check if a specific set of rows is hidden (based on the value of B2)
- Hide the set of rows if it is hidden
- Unhide the set of rows if it is hidden
I would be eternally grateful if someone would help out. I understand I am asking for basically the whole thing, but I have erased so many attempts I lost hope.
VBA Code:
'[I]Cup[/I]
Rows("64:83,103:120,121:124,147:172,173:178,179:181,217:242,243:248,249:251,286:317,318:327,328:330,394:412,413:415,439:464,465:468,500:524,525:528,529:531,563:584,585:588,615:635,636:638,663:686").Select
Selection.EntireRow.Hidden = True
'[I]Glass[/I]
Rows("84:102,125:142,143:146,182:207,208:213,214:216,252:276,277:282,283:285,331:365,366:371,372:375,416:435,436:438,469:495,496:499,532:555,556:559,560:562,589:610,611:614,639:659,660:662,687:707").Select
Selection.EntireRow.Hidden = True