Rows not hidden

Starkers

New Member
Joined
Oct 26, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone

I have inserted a vba code to have the rows 17 to 25 hidden but it seems that row 25 was not hidden. Not sure what is the issue here..

VBA Code:
If Range("C16") = "Malaysia" Then
    If Range("C7") = "Yes" Or Range("C7") = "No" Then
        Rows("17:25").EntireRow.Hidden = True
        
    Else
        Rows("17:25").EntireRow.Hidden = False
        
    End If

End If
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
have inserted a vba code to have the rows 17 to 25 hidden but it seems that row 25 was not hidden.
Then perhaps C16 is not Malaysia (case-sensitive) or C7 is not equal to Yes or No (both case-sensitive)?

What were the exact values of C16 and C7 when the code ran and what more is there to this code as we do not have all of it?

BTW, when you refer to rows as you have, Rows("17:25"), these are already entire rows so you don't need to specify EntireRow as well. This would do just as well
VBA Code:
Rows("17:25").Hidden = True
 
Upvote 0
Then perhaps C16 is not Malaysia (case-sensitive) or C7 is not equal to Yes or No (both case-sensitive)?

What were the exact values of C16 and C7 when the code ran and what more is there to this code as we do not have all of it?

BTW, when you refer to rows as you have, Rows("17:25"), these are already entire rows so you don't need to specify EntireRow as well. This would do just as well
VBA Code:
Rows("17:25").Hidden = True

went to look through the code and found that there was a conflicting criteria. thanks for the assistance anyway!
 
Last edited by a moderator:
Upvote 0
No problem. Glad you located the issue and thanks for letting us know. :)
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top