Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Have something occur on scroll

Suppose I have a worksheet active. At any given time, a certain set of rows
on the sheet are being displayed.

1) How would I have a VBA put the correct values in the variables
FirstRowBeingDisplayed as Long
LastRowBeingDisplayed as Long

2) The program terminates and the user is now in the direct mode. He is
free to move around in the worksheet. How might I set it up so that if his
moving around (with the arrow keys, mouse, or scroll bar, or whatever)
trggers a scrolling event, a subroutine Scroll_Routine is executed. )By
scrolling event I means an event which changes the set of cells displayed).
The first thing I want Scroll_Routine to do is to assign the correct values
to the variables FirstRowBeingDisplayed, LastRowBeingDisplayed,
FirstColBeingDisplayed, LastColBeingDisplayed.

Thank you




--
-regards
  #2   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Have something occur on scroll

to answer your first question:

Dim lngFirstRowBeingDisplayed As Long
Dim lngLastRowBeingDisplayed As Long

With ActiveWindow.VisibleRange
lngFirstRowBeingDisplayed = .Rows(1).Row
lngLastRowBeingDisplayed = .Rows(.Rows.Count).Row
End With

MsgBox lngFirstRowBeingDisplayed & ":" & lngLastRowBeingDisplayed

Don't know about the second. XL does not have a scroll event for
worksheets. Depending on what you need the first and last rows for - perhaps
one of the built in worksheet event handlers would be equally suitable.


"GeorgeJ" wrote:

Suppose I have a worksheet active. At any given time, a certain set of rows
on the sheet are being displayed.

1) How would I have a VBA put the correct values in the variables
FirstRowBeingDisplayed as Long
LastRowBeingDisplayed as Long

2) The program terminates and the user is now in the direct mode. He is
free to move around in the worksheet. How might I set it up so that if his
moving around (with the arrow keys, mouse, or scroll bar, or whatever)
trggers a scrolling event, a subroutine Scroll_Routine is executed. )By
scrolling event I means an event which changes the set of cells displayed).
The first thing I want Scroll_Routine to do is to assign the correct values
to the variables FirstRowBeingDisplayed, LastRowBeingDisplayed,
FirstColBeingDisplayed, LastColBeingDisplayed.

Thank you




--
-regards

  #3   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Have something occur on scroll

with regards to your second question - this was posted by Chip Pearson to
another poster asking about scroll events in XL:


There is no event that is triggered when you scroll in a window. You can use
a technique called "subclassing" to detect the Windows messages sent during
scrolling. VBA doesn't have the performance horsepower to do the actual
subclassing itself, so I use a free DLL from vbAccellerator,
www.vbaccellerator.com, called SSubTimer6.dll. Once you have that DLL on
your machine, you can use the class module on my web site to detect
scrolling. The class will raise normal VBA events for scrolling up/down
left/right by page/line.

See http://www.cpearson.cm/Excel/DetectScroll.htm details and downloadable
example workbook.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




"GeorgeJ" wrote:

Suppose I have a worksheet active. At any given time, a certain set of rows
on the sheet are being displayed.

1) How would I have a VBA put the correct values in the variables
FirstRowBeingDisplayed as Long
LastRowBeingDisplayed as Long

2) The program terminates and the user is now in the direct mode. He is
free to move around in the worksheet. How might I set it up so that if his
moving around (with the arrow keys, mouse, or scroll bar, or whatever)
trggers a scrolling event, a subroutine Scroll_Routine is executed. )By
scrolling event I means an event which changes the set of cells displayed).
The first thing I want Scroll_Routine to do is to assign the correct values
to the variables FirstRowBeingDisplayed, LastRowBeingDisplayed,
FirstColBeingDisplayed, LastColBeingDisplayed.

Thank you




--
-regards

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Totalling subtotals which occur in unstructured pattern. davidthegolfer Excel Discussion (Misc queries) 0 June 28th 06 10:07 AM
Return Value If Two Conditions occur Hatman Excel Worksheet Functions 5 January 30th 06 08:34 PM
Problem occur in sum function while deleting the rows Ellis Yu Excel Worksheet Functions 0 October 26th 05 02:50 AM
Get excel to list values that occur within raw data dennis34 Excel Discussion (Misc queries) 2 October 5th 05 12:09 PM
counting non occur entries excelFan Excel Discussion (Misc queries) 2 December 15th 04 07:15 PM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"