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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
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,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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