+ Reply to Thread
Results 1 to 9 of 9

Draw lines between cells

  1. #1
    Forum Contributor
    Join Date
    11-03-2009
    Location
    Florida
    MS-Off Ver
    Excel 365
    Posts
    289

    Draw lines between cells

    Thanks to the help I received on another post, I got the conditional formatting to work on this sheet. Now I am trying to figure out how to draw lines between highlighted cells as I did manually in the attached sample. I found some VBA online but it was beyond my comprehension and I could not figure out how to identify the highlighted cells. I will be doing a lot of these, some as much as 60 columns wide.
    Thanks for all you guys do.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Draw lines between cells

    Maybe I don't figure out exactly what you want, but try this one.

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Draw lines between cells

    try this

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Draw lines between cells

    Sorry, I've realized I'd misunderstood Len's post.
    Forget about my code. Andy's solution will be correct.
    Last edited by yujin; 02-21-2018 at 09:02 AM.

  5. #5
    Forum Contributor
    Join Date
    11-03-2009
    Location
    Florida
    MS-Off Ver
    Excel 365
    Posts
    289

    Re: Draw lines between cells

    Thanks Andy.
    I get run-time error '438':
    Object doesn't support this property or method.

    The debugger highlights:
    If data.Cells(rowIndex, colIndex).DisplayFormat.Interior.Color = data.Cells(rowIndex, colIndex).FormatConditions(1).Interior.Color Then

    Am I supposed to install the function and the sub in the same module?

    Thanks

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Draw lines between cells

    I would guess the DisplayFormat is not available in excel 2007.

    You would need code to determine whether the conditional formating has been applied to any of the cells. The basically means applying the same CF test in the vba code.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Draw lines between cells

    Quote Originally Posted by Andy Pope View Post
    I would guess the DisplayFormat is not available in excel 2007.
    Indeed; introduced in Excel 2010.

    Nice to have you stop by, Andy -- we don't see enough of you.
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Draw lines between cells

    Another that won't work in 2007

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  9. #9
    Forum Contributor
    Join Date
    11-03-2009
    Location
    Florida
    MS-Off Ver
    Excel 365
    Posts
    289

    Re: Draw lines between cells

    Thanks all!
    I never really had a reason to upgrade until now, but this is an important project to me. Hello, Microsoft?

    Here is the CF code I am using. Can anyone help me incorporate it into the script?

    Please Login or Register  to view this content.

+ 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. Draw 3 points with 2 limit lines on a graph
    By Karen16 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2017, 11:55 AM
  2. Replies: 3
    Last Post: 02-02-2017, 03:04 AM
  3. Formula to draw known didtance between parallel lines.
    By davesexcel in forum Excel General
    Replies: 5
    Last Post: 11-05-2014, 09:27 PM
  4. Draw lines in a chart
    By ravichander in forum Excel Charting & Pivots
    Replies: 33
    Last Post: 07-12-2008, 08:31 AM
  5. Can you draw lines through the center of cells, using cell numbers as references?
    By iterature in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2007, 06:06 AM
  6. [SOLVED] VBA draw and erase lines (crosshairs) on form
    By gary in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2006, 07:10 AM
  7. [SOLVED] Excel VBA - How to draw lines & boxes on a Form ?
    By tmb in forum Excel General
    Replies: 1
    Last Post: 04-07-2005, 10:06 PM

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