+ Reply to Thread
Results 1 to 5 of 5

Offsetting from a Shape

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Offsetting from a Shape

    I would like to create multiple buttons on a worksheet that will run the following macro. At the beginning of the code instead of offsetting from the active cell is there a way to offset one row lower from the activeshape? Each shape will be in row 57 and I would like to offset to row 58 in the first line of the code.


    Sub DeleteTrade()
    
    ActiveCell.Offset(1, 0).Select
    
    Range(ActiveCell, ActiveCell.Offset(35, 23)).Select
    
    ActiveCell.Offset(36, 13).Select
    
        Range(Selection, Selection.End(xlToRight)).Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Select
        
    ActiveCell.Offset(0, -14).Select
    
    Range(ActiveCell, ActiveCell.Offset(0, 24)).EntireColumn.Select
    
    Selection.Delete Shift:=xlToLeft
    
    End Sub
    Last edited by rhudgins; 05-13-2011 at 11:33 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Offsetting from a Shape

    rhudgins

    something like this?
    ActiveSheet.Buttons(Application.Caller).TopLeftCell.Offset(1, 0).Select


    Hope that helps,
    ~tigeravatar

  3. #3
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Offsetting from a Shape

    I am recieving an error that it is unable to get the buttons property of the worksheet class.

    Will this execute only on the button that is clicked to run the macro?

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Offsetting from a Shape

    rhudgins,

    The macro is designed to run from any button mapped to the macro. The Application.Caller method gets the button that was clicked (the item that "called" the macro).

    ~tigeravatar

  5. #5
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Offsetting from a Shape

    Thank you this is helpful

+ Reply to Thread

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