VBA to determine if rows are visible on the screen?

Matty

Well-known Member
Joined
Feb 17, 2007
Messages
3,717
Hi All,

I'm after some code to test whether rows 1:7 and are rows 129:135 are visible on the screen. Since different screen sizes/resolutions show different things, I need this test to be carried out before further code executes.

Can anyone suggest how this could be done?

Thanks,

Matty
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi All,

I'm after some code to test whether rows 1:7 and are rows 129:135 are visible on the screen. Since different screen sizes/resolutions show different things, I need this test to be carried out before further code executes.
Does all rows of those ranges have to be visible or would knowing if at least one row of those rows is visible be enough?
 
Upvote 0
Hi Rick,

If the test was just against row 1 and row 129, that'd be fine.

Thanks,

Matty
 
Upvote 0
Hi Rick,

If the test was just against row 1 and row 129, that'd be fine.
These lines of code will report True if Row 1 and Row 129 are visible, False otherwise...

IsRowOneVisible = Not Intersect(Rows(1), ActiveWindow.VisibleRange) Is Nothing

IsRow129Visible = Not Intersect(Rows(129), ActiveWindow.VisibleRange) Is Nothing
 
Upvote 0
These lines of code will report True if Row 1 and Row 129 are visible, False otherwise...

IsRowOneVisible = Not Intersect(Rows(1), ActiveWindow.VisibleRange) Is Nothing

IsRow129Visible = Not Intersect(Rows(129), ActiveWindow.VisibleRange) Is Nothing
Rick, your solution is simple, that's is what I was looking. Many thanks.
 
Upvote 0

Forum statistics

Threads
1,218,945
Messages
6,145,365
Members
450,612
Latest member
OVSD_DS

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