+ Reply to Thread
Results 1 to 4 of 4

Aperiodic patterns

  1. #1
    Registered User
    Join Date
    01-18-2015
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    51

    Aperiodic patterns

    Does anyone know how to make this in excel?

    An IF function that draws a line through a cell based on a certain value?

    http://euler.slu.edu/escher/upload/t...px-Random2.jpg

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: Aperiodic patterns

    an IF formula can only return a value based on a condition; it cannot return a format.
    With conditional formatting you can return all other forms of cells borders, but not diagonal borders.

    However, this can be achieved with VBA. Check this link.
    HTH!

  3. #3
    Registered User
    Join Date
    01-18-2015
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    51

    Re: Aperiodic patterns

    Hi thanks a lot.

    I have one more question.

    I tried to adjust the code so it creates a line down if it is a 1 and up if it is a 0.

    Sometimes it works, and sometimes it makes an X.

    How would you fix this?

    Untitled.jpg


    ---

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim c As Variant
    Dim addr As String

    Set Target = Range("A1:C20")

    If Intersect(Target, ActiveCell) Is Nothing Then Exit Sub
    For Each c In Target
    If c = 0 And Len(c) <> 0 Then
    addr = c.Address
    With Range(addr).Borders(xlDiagonalUp)
    .LineStyle = xlContinuous
    End With
    ElseIf c = 1 And Len(c) <> 0 Then
    addr = c.Address
    With Range(addr).Borders(xlDiagonalDown)
    .LineStyle = xlContinuous
    End With
    End If
    Next
    End Sub

  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: Aperiodic patterns

    this should do it:
    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. lottery 6 for 10 patterns
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-05-2014, 01:10 PM
  2. 6 patterns lottery
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-30-2014, 06:14 AM
  3. Converting 2007 VBA color patterns to 2003 color patterns
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-13-2011, 12:00 PM
  4. Setting patterns
    By Brisbane Rob in forum Excel General
    Replies: 1
    Last Post: 04-28-2006, 07:57 PM
  5. [SOLVED] more colors for patterns
    By Mark G. in forum Excel General
    Replies: 1
    Last Post: 01-12-2006, 06:10 AM
  6. Ordering Patterns
    By Tom Hewitt in forum Excel General
    Replies: 0
    Last Post: 09-20-2005, 11:05 AM
  7. patterns
    By DArinello in forum Excel Formulas & Functions
    Replies: 60
    Last Post: 09-06-2005, 06:05 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