Results 1 to 3 of 3

Selecting cells based on button location

Threaded View

Jon.R Selecting cells based on... 08-03-2011, 02:58 PM
StephenR Re: Selecting cells based on... 08-03-2011, 03:04 PM
Jon.R Re: Selecting cells based on... 08-03-2011, 03:09 PM
  1. #1
    Registered User
    Join Date
    06-09-2011
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    17

    Selecting cells based on button location

    Hello, a bit of an excel noob here, any help much appreciated!

    I have (automatically generated) buttons that all need to reference the same macro. This macro needs to remove a range of cells based on the button's position... I have come across this code:

    Sub Button1_Click()
        With ActiveSheet.Buttons(1) 'Form Control
            Range(.TopLeftCell.Offset(-3, 0), .BottomRightCell.Offset(4, 0)).EntireRow.Delete
        End With
    End Sub

    Which works PERFECTLY for the first button created, however I need the button to be copied and pasted several times (a single macro to be able to be called)... does anyone know if this is possible in VBA? I was hoping for something like:

    This.Button.Topleftcell ...

    Again, any help much appreciated!
    Last edited by Jon.R; 08-03-2011 at 03:09 PM.

Thread Information

Users Browsing this Thread

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

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