Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Command button

dear all,

i have a command button in excel sheet and i want it to move and hold
its place even if the window is scrolled ( i want it to be visible on
the screen when the window is scrolled). Normally,
it stays where you have placed it and disappears when you scroll the
window.

i appreciate your help in this regard,

thanks,
Naweed

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Command button

One method.

Freeze a row or two at top of sheet and place the button above that freeze line.


Gord Dibben MS Excel MVP

On Wed, 08 Aug 2007 20:57:35 -0700, User wrote:

dear all,

i have a command button in excel sheet and i want it to move and hold
its place even if the window is scrolled ( i want it to be visible on
the screen when the window is scrolled). Normally,
it stays where you have placed it and disappears when you scroll the
window.

i appreciate your help in this regard,

thanks,
Naweed


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Command button

On Aug 9, 8:04 am, Gord Dibben <gorddibbATshawDOTca wrote:
One method.

Freeze a row or two at top of sheet and place the button above that freeze line.

Gord Dibben MS Excel MVP



On Wed, 08 Aug 2007 20:57:35 -0700, User wrote:
dear all,


i have a command button in excel sheet and i want it to move and hold
its place even if the window is scrolled ( i want it to be visible on
the screen when the window is scrolled). Normally,
it stays where you have placed it and disappears when you scroll the
window.


i appreciate your help in this regard,


thanks,
Naweed- Hide quoted text -


- Show quoted text -


Thanks,

but i want to do it with VBA , freezing isn't ideal for the sheet i m
using.

regards,
Naweed

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Command button

yes, i snatched some coding off the internet that does exactly that.
unfortunately i don't think i have it here at work........
aha! i found it!

'=============================
'revised 6/28/07 - added the commandbutton movement
'as below - original code did not dim variables

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'by Orlando Magalhães Filho in .programming

Dim x_offset As Long
Dim y_offset As Long
Dim xpos As Long
Dim ypos As Long

'revised 7/16/07
'added a random control controlling this action,
'doing it every time there was a worksheet_change
'was too slow & cumbersome.

If Range("k702") = 4 Then

Application.ScreenUpdating = False

x_offset = 10
y_offset = 10

ActiveSheet.Shapes("CommandButton1").Select

With Cells(ActiveWindow.Panes(1).ScrollRow, _
ActiveWindow.Panes(1).ScrollColumn)
' xpos = .Right + x_offset THERE IS NO .RIGHT PROPERTY
xpos = .Left + x_offset
ypos = .Top + y_offset
End With

With Selection
.Left = xpos
.Top = ypos
End With

Target.Select

Application.ScreenUpdating = True

End If

End Sub
'============================

i made a few modifications - since i didn't want this worksheet change
to fire completely every single time there was a change, i placed

=RAND()*5
in k701 and
=ROUND(K701,0)
in k702

the macro checks that cell (k702), & if it doesn't equal 4 it just
exits - much quicker, and yet it does update the command button to my
current location fairly often. also, adjust the x, y offsets to suit
- for me i set these to 2.
hope it helps!
susan




On Aug 9, 12:15 am, User wrote:
On Aug 9, 8:04 am, Gord Dibben <gorddibbATshawDOTca wrote:





One method.


Freeze a row or two at top of sheet and place the button above that freeze line.


Gord Dibben MS Excel MVP


On Wed, 08 Aug 2007 20:57:35 -0700, User wrote:
dear all,


i have a command button in excel sheet and i want it to move and hold
its place even if the window is scrolled ( i want it to be visible on
the screen when the window is scrolled). Normally,
it stays where you have placed it and disappears when you scroll the
window.


i appreciate your help in this regard,


thanks,
Naweed- Hide quoted text -


- Show quoted text -


Thanks,

but i want to do it with VBA , freezing isn't ideal for the sheet i m
using.

regards,
Naweed- Hide quoted text -

- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Command button

You could FREEZE the Window Pane just below the button, this way the button will remain in view at
all times, no matter how far you scroll down??


Corey....
"User" wrote in message
ups.com...
dear all,

i have a command button in excel sheet and i want it to move and hold
its place even if the window is scrolled ( i want it to be visible on
the screen when the window is scrolled). Normally,
it stays where you have placed it and disappears when you scroll the
window.

i appreciate your help in this regard,

thanks,
Naweed




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Command button

It sounds like you may be better using a new toolbar (in xl2003 and below).

User wrote:

dear all,

i have a command button in excel sheet and i want it to move and hold
its place even if the window is scrolled ( i want it to be visible on
the screen when the window is scrolled). Normally,
it stays where you have placed it and disappears when you scroll the
window.

i appreciate your help in this regard,

thanks,
Naweed


--

Dave Peterson
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
Wanting to Create A Command Button Command bumper338 Excel Programming 3 May 7th 07 06:53 PM
VB's Command Button vs Form's Command Button Ronald Dodge Excel Programming 3 May 24th 06 02:23 PM
Command Button vs Form Button Bri[_3_] Excel Programming 2 February 3rd 06 08:18 AM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


All times are GMT +1. The time now is 08:03 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"