Results 1 to 5 of 5

How to execute a line-drawing subroutine/macro?

Threaded View

JDoe314 How to execute a line-drawing... 04-04-2014, 08:23 PM
patel45 Re: How to execute a... 04-04-2014, 11:38 PM
JDoe314 Re: How to execute a... 04-04-2014, 11:47 PM
patel45 Re: How to execute a... 04-05-2014, 12:32 AM
JDoe314 Re: How to execute a... 04-05-2014, 12:41 AM
  1. #1
    Registered User
    Join Date
    04-04-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    7

    How to execute a line-drawing subroutine/macro?

    I am a complete novice in excel and VBA scripting. I need to know how to execute this subroutine:
    Sub Connect(r1 As Range, r2 As Range) 
        ActiveSheet.Shapes.AddLine r1.Left + r1.Width / 2, r1.Top + r1.Height / 2, _ 
        r2.Left + r2.Width / 2, r2.Top + r2.Height / 2 
    End Sub
    called like:

    Connect Range("A3"), Range("D7")

    that I found in an excel forum. My intention is to eventually be able to select two cells and then run a sub to draw a line between them. I suppose this would mean having some sort of thing to extract the cell locations from the selected cells, and then running the aforementioned subroutine with the selected cell locations as inputs.
    Last edited by Leith Ross; 04-04-2014 at 09:07 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Loop that waits for a subroutine to execute
    By Aristizabal95 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-02-2013, 11:38 PM
  2. Command line for open excel, insert a sheet, execute a macro, save file exit?
    By uschxc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2012, 12:28 PM
  3. How do i execute a subroutine?
    By wlan in forum Excel General
    Replies: 4
    Last Post: 11-22-2010, 02:34 AM
  4. [SOLVED] How to execute a excel subroutine from visual basic
    By Ivan Lozada in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2006, 09:55 AM
  5. Execute a macro from command line: possible or not ?
    By Drinkmilk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-24-2006, 06:55 AM

Tags for this Thread

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