Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
method select of object range failed
All,
I am writing code that creates a user form used to scroll through a filtered list of photos and their attributes and it works great, until a filter hides more than 280 consecutive rows of data. If I scroll over the hidden rows my code crashes at the following line Cells(scr_photo.Value, 1).EntireRow.Activate where scr_photo is the current row that fills the data form. The reason I activate the current row is so the user can see what row the form data is coming from as they scroll through the list. This works great in all other aspects except for the case mentioned above. Any ideas or ways to fix the problem. I have already tried .Select instead of .Activate and I get the same error. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
method select of object range failed
Take a look at this piece of code and see if it helps you at all.
Option Explicit Sub Test() Dim scr_photo As Excel.Range Set scr_photo = Range("A10") Cells(scr_photo.value.1).EntireRow.Hidden = True If Cells(scr_photo.Value, 1).EntireRow.Hidden Then Cells(scr_photo.Value, 1).EntireRow.Hidden = False End If Cells(scr_photo.Value, 1).EntireRow.Activate End Sub "quaz" wrote: All, I am writing code that creates a user form used to scroll through a filtered list of photos and their attributes and it works great, until a filter hides more than 280 consecutive rows of data. If I scroll over the hidden rows my code crashes at the following line Cells(scr_photo.Value, 1).EntireRow.Activate where scr_photo is the current row that fills the data form. The reason I activate the current row is so the user can see what row the form data is coming from as they scroll through the list. This works great in all other aspects except for the case mentioned above. Any ideas or ways to fix the problem. I have already tried .Select instead of .Activate and I get the same error. Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
method select of object range failed
Barb,
Thanks, but that won't quite do it. I do like the idea of defining my row variable as type range, it makes my code more efficient and easy to read, but the problem still remains that if there are more than 280 hidden rows due to an applied data filter the program crashes. And by crashing I mean I get the error mentioned above and I have to force excel to exit because it is locked up. I have also tried to just format the current row in bold instead of activating or selecting it, but the same problem occurs (probably due to excel activating the row when I change the format). If you have any other ideas please let me know. Thanks. "Barb Reinhardt" wrote: Take a look at this piece of code and see if it helps you at all. Option Explicit Sub Test() Dim scr_photo As Excel.Range Set scr_photo = Range("A10") Cells(scr_photo.value.1).EntireRow.Hidden = True If Cells(scr_photo.Value, 1).EntireRow.Hidden Then Cells(scr_photo.Value, 1).EntireRow.Hidden = False End If Cells(scr_photo.Value, 1).EntireRow.Activate End Sub "quaz" wrote: All, I am writing code that creates a user form used to scroll through a filtered list of photos and their attributes and it works great, until a filter hides more than 280 consecutive rows of data. If I scroll over the hidden rows my code crashes at the following line Cells(scr_photo.Value, 1).EntireRow.Activate where scr_photo is the current row that fills the data form. The reason I activate the current row is so the user can see what row the form data is coming from as they scroll through the list. This works great in all other aspects except for the case mentioned above. Any ideas or ways to fix the problem. I have already tried .Select instead of .Activate and I get the same error. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Method Range of Object Global Failed | Excel Programming | |||
Method 'Range' of object '_Global' failed | Excel Programming | |||
Method 'Range' of object '_Global' failed | Excel Programming | |||
Method Range of object '_Global' failed | Excel Programming | |||
Method Range of object global failed | Excel Programming |