Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bon Bon is offline
external usenet poster
 
Posts: 23
Default How to make created button move with scrollbar?

Hello all

How to make created buttons in worksheet move with worksheet scrollbar?

I have a workbook and there are 10 worksheets in it. Each worksheet I
will put two buttons (Next and Previous). The above buttons are used to
jump to next/previous worksheets. When the worksheet scrollbar is moved
up/down, the two buttons will move up/down as well.

Please give me some advices.

Thanks
Bon

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to make created button move with scrollbar?

Create a commandbar with the previous and next buttons, rather
than using button controls.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Bon" wrote in message
oups.com...
Hello all

How to make created buttons in worksheet move with worksheet
scrollbar?

I have a workbook and there are 10 worksheets in it. Each
worksheet I
will put two buttons (Next and Previous). The above buttons are
used to
jump to next/previous worksheets. When the worksheet scrollbar
is moved
up/down, the two buttons will move up/down as well.

Please give me some advices.

Thanks
Bon



  #3   Report Post  
Posted to microsoft.public.excel.programming
Bon Bon is offline
external usenet poster
 
Posts: 23
Default How to make created button move with scrollbar?

Would it be possible to create buttons for doing it? What commands or
methods I should use?

Thanks
Bon

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default How to make created button move with scrollbar?

Hi Bon,

This is probably bad advice.....

MyButton is from the forms toolbar, on Sheet1, and Excel named it
"Button 1".
The code is in the Sheet1 Module, is triggered when you change the
selection and moves MyButton so that it is sitting just to the left of
the new selection.
Could get annoying though, and would have to be moved out of the way
with a right click/drag to see the cell(s) it covers.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim MyButton As Shape
Set MyButton = Sheet1.Shapes("Button 1")
With MyButton
.Top = Target.Top
.Left = Target.Left - .Width
End With
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
Bon Bon is offline
external usenet poster
 
Posts: 23
Default How to make created button move with scrollbar?

The suggested code make buttons move with mouse click to cell(s). But,
how can I make buttons move with scrollbar. It is like some graphics on
the web. When the user scroll down the page, the buttons move down as
well.

What methods or events I should use? Please give me some advices.

Thanks
Bon
Ken Johnson 寫道:

Hi Bon,

This is probably bad advice.....

MyButton is from the forms toolbar, on Sheet1, and Excel named it
"Button 1".
The code is in the Sheet1 Module, is triggered when you change the
selection and moves MyButton so that it is sitting just to the left of
the new selection.
Could get annoying though, and would have to be moved out of the way
with a right click/drag to see the cell(s) it covers.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim MyButton As Shape
Set MyButton = Sheet1.Shapes("Button 1")
With MyButton
.Top = Target.Top
.Left = Target.Left - .Width
End With
End Sub




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default How to make created button move with scrollbar?

Hi Bon,
Excel doesn't have a scroll event. Selection change was the closest I
could get to what you are after.

Changing: .Left = Target.Left - .Width to ...

.Left = Cells(1,ActiveWindow.ScrollColumn).Left

will keep the button on the left side of the screen.

I think a customised toolbar would be a better solution.

Ken Johnson

  #7   Report Post  
Posted to microsoft.public.excel.programming
Bon Bon is offline
external usenet poster
 
Posts: 23
Default How to make created button move with scrollbar?

Thanks Ken

Bon
Ken Johnson 寫道:

Hi Bon,
Excel doesn't have a scroll event. Selection change was the closest I
could get to what you are after.

Changing: .Left = Target.Left - .Width to ...

.Left = Cells(1,ActiveWindow.ScrollColumn).Left

will keep the button on the left side of the screen.

I think a customised toolbar would be a better solution.

Ken Johnson


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
How do I make my spreadsheet so part of it has it's own scrollbar SarahQ Excel Discussion (Misc queries) 1 September 5th 06 08:41 AM
How to make scrollbar disappear after clearing textbox? RB Smissaert Excel Programming 1 November 6th 05 11:08 AM
Button not bring up Macro I created A.S. Excel Discussion (Misc queries) 1 July 22nd 05 10:21 PM
scrollbar reslut makes another scrollbar to show Patrik Excel Discussion (Misc queries) 0 April 18th 05 03:11 PM
How do I assign a macro I have created to a Command Button in Exc. Andrew7675 Excel Discussion (Misc queries) 1 March 3rd 05 08:08 PM


All times are GMT +1. The time now is 08:25 PM.

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

About Us

"It's about Microsoft Excel"