+ Reply to Thread
Results 1 to 3 of 3

Floating Command Button

Hybrid View

mitank Floating Command Button 07-03-2017, 04:35 AM
Richard Buttrey Re: Floating Command Button 07-03-2017, 05:21 AM
bakerman2 Re: Floating Command Button 07-03-2017, 06:18 AM
  1. #1
    Registered User
    Join Date
    02-24-2011
    Location
    mumbai
    MS-Off Ver
    Excel 2003
    Posts
    7

    Floating Command Button

    I have read this at https://www.excelforum.com/excel-gen...nd-button.html

    But the floating command button does not work.

    Please see the example sheet.

    Please also let me know how to place the VBA code in my main excel sheet as the position of command button is different as the one in example sheet
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Floating Command Button

    Use instead code like...

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
        With ActiveSheet.Shapes("button 1")
            .Top = ActiveCell.Top
            .Left = ActiveCell.Left + 2 * ActiveCell.Width
        End With
    
    End Sub
    The Me. command usually refers to a VBA UserForm.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,302

    Re: Floating Command Button

    Or this one.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      With ActiveWindow.VisibleRange.Resize(1, 1).Offset(1, 1)
        ActiveSheet.Shapes("button 1").Top = .Top: ActiveSheet.Shapes("button 1").Left = .Left
       End With
    End Sub
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Floating Command button
    By Probyn in forum Excel General
    Replies: 17
    Last Post: 06-06-2017, 01:31 AM
  2. Floating Command Button
    By tapsmiled in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-27-2014, 08:36 PM
  3. Floating command button
    By Pat in forum Excel General
    Replies: 5
    Last Post: 08-31-2012, 03:49 PM
  4. Floating Command Button
    By GuruWannaB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-07-2009, 04:50 PM
  5. Floating Command button
    By kev_06 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2006, 06:15 PM
  6. [SOLVED] Create floating button based on button click in menu
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2005, 02:05 PM
  7. [SOLVED] How can I create a Floating Command Button
    By Karoo News in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2005, 07:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1