ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveWindow.ScrollRow and ScrollColumn (https://www.excelbanter.com/excel-programming/335567-activewindow-scrollrow-scrollcolumn.html)

David Welch[_2_]

ActiveWindow.ScrollRow and ScrollColumn
 
Hi,

I am attempting to use the ScrollRow and ScrollColumn properties of the
ActiveWindow. My problem is when a user clicks on an item in a list box
I want the activewindow to scroll to the relevant range for that item so
that the user doesn't have to do it herself, ie

ActiveWindow.ScrollRow = SourceRange.Row
ActiveWindow.ScrollColumn = SourceRange.Column

Unfortunatly both the scrollrow and scrollcolumn props don't work and
neither does the ActiveWindow.ScrollIntoView. I have also tried the
Range.Show method.

I have set the modal property of the form to false, and so I can move
around the window manually. All that happens when ScrollRow etc is used
seems to be that the selection the was present when the form first
started comes into view.

I have tried to set selection programmatically first but this doesn't
work either.

Thanks for any help.

---
Dave

FSt1

ActiveWindow.ScrollRow and ScrollColumn
 
hi,
if all that is not working, might i suggest that you use find instead. that
would take the user to the item.
here is code i wrote for a combo box and just adapted it to a list box.
it works on xl2k.

Private Sub ListBox2_Click()
Dim c As String
Dim Rng As Range
c = Me.ListBox2.Value
If c = "" Then Exit Sub
Set Rng = Range("A1:AC500").Find(What:=c, _
After:=Range("A1"), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
Rng.Select
End Sub

Regards

FSt1
"David Welch" wrote:

Hi,

I am attempting to use the ScrollRow and ScrollColumn properties of the
ActiveWindow. My problem is when a user clicks on an item in a list box
I want the activewindow to scroll to the relevant range for that item so
that the user doesn't have to do it herself, ie

ActiveWindow.ScrollRow = SourceRange.Row
ActiveWindow.ScrollColumn = SourceRange.Column

Unfortunatly both the scrollrow and scrollcolumn props don't work and
neither does the ActiveWindow.ScrollIntoView. I have also tried the
Range.Show method.

I have set the modal property of the form to false, and so I can move
around the window manually. All that happens when ScrollRow etc is used
seems to be that the selection the was present when the form first
started comes into view.

I have tried to set selection programmatically first but this doesn't
work either.

Thanks for any help.

---
Dave


David Welch[_2_]

ActiveWindow.ScrollRow and ScrollColumn
 
Oops, my problem was I was getting the wrong range to show!

Now doing show on the right range goes to the correct place, but thanks
anyway.


FSt1 wrote:
hi,
if all that is not working, might i suggest that you use find instead. that
would take the user to the item.
here is code i wrote for a combo box and just adapted it to a list box.
it works on xl2k.

Private Sub ListBox2_Click()
Dim c As String
Dim Rng As Range
c = Me.ListBox2.Value
If c = "" Then Exit Sub
Set Rng = Range("A1:AC500").Find(What:=c, _
After:=Range("A1"), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
Rng.Select
End Sub

Regards

FSt1
"David Welch" wrote:


Hi,

I am attempting to use the ScrollRow and ScrollColumn properties of the
ActiveWindow. My problem is when a user clicks on an item in a list box
I want the activewindow to scroll to the relevant range for that item so
that the user doesn't have to do it herself, ie

ActiveWindow.ScrollRow = SourceRange.Row
ActiveWindow.ScrollColumn = SourceRange.Column

Unfortunatly both the scrollrow and scrollcolumn props don't work and
neither does the ActiveWindow.ScrollIntoView. I have also tried the
Range.Show method.

I have set the modal property of the form to false, and so I can move
around the window manually. All that happens when ScrollRow etc is used
seems to be that the selection the was present when the form first
started comes into view.

I have tried to set selection programmatically first but this doesn't
work either.

Thanks for any help.

---
Dave



All times are GMT +1. The time now is 06:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com