+ Reply to Thread
Results 1 to 10 of 10

Change pattern based on cell value (Multiple conditions)

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Change pattern based on cell value (Multiple conditions)

    As per attached excel file, I want 4 pattern condition to run automatically when text inside cell C6 changed.

    http://www.excelforum.com/attachment...1&d=1462856509

    Code 1 have so far

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Sheets("TEST").Range("C6").Value = "Quarterly" Then
    Call Change_Pattern_Quarterly
    End If
    End Sub
    'Monthly
    'Bimonthly
    'Quarterly
    'Weekly
    Sub Change_Pattern_Monthly()
    If Range("C6").Value = "Monthly" Then
        With Range("E10:P32")
            With .Interior
                 .Pattern = xlPatternLightUp
            End With
        End With
    End If
    End Sub
    
    Sub Change_Pattern_Bimonthly()
    If Range("C6").Value = "Bimonthly" Then
        With Range("E10:P32,B12:D12,B16:D16,B20:D20,B24:D24,B28:D28,B32:D32")
            With .Interior
                 .Pattern = xlPatternLightUp
            End With
        End With
    End If
    End Sub
    
    Sub Change_Pattern_Quarterly()
    If Range("C6").Value = "Quarterly" Then
        With Range("E10:P32,B12:D20,B24:D32")
            With .Interior
                 .Pattern = xlPatternLightUp
            End With
        End With
    End If
    End Sub
    
    Sub Change_Pattern_Weekly()
    If Range("C6").Value = "Weekly" Then
        With Range("A10:P32")
            With .Interior
                 .Pattern = xlPatternNone
            End With
        End With
    End If
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Change pattern based on cell value (Multiple conditions)

    Why code it when it can be done using Conditional Formatting?

  3. #3
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Re: Change pattern based on cell value (Multiple conditions)

    Hi cytop,

    already open a thread regarding conditional formatting, nobody want to help..

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Change pattern based on cell value (Multiple conditions)

    Not saying it's exactly what you want, but Conditional Formatting applied for the various frequencies. I've used solid colours only because the pattern you had causes moiré effects on my screen. You can edit the fill/patterns to suit yourself.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Re: Change pattern based on cell value (Multiple conditions)

    Hi again cytop, after changing the pattern, it seem doesnt work. anyhelp?

    what im missing here?

    http://www.excelforum.com/attachment...1&d=1462869724
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Re: Change pattern based on cell value (Multiple conditions)

    Thank you cytop, now im understand why my formula didnt work. Need to use "," to apply to multiple area. Many thanks!

    =$B$12:$D$20,$B$24:$D$32,$E$10:$P$32

  7. #7
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Re: Change pattern based on cell value (Multiple conditions)

    OK, moiré effects

  8. #8
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Change pattern based on cell value (Multiple conditions)

    Do you still have a problem? Like I said, I only used a solid color as I didn't fancy a headache when I scroll the worksheet...

  9. #9
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Re: Change pattern based on cell value (Multiple conditions)

    Solved. Many Thanks!

  10. #10
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Change pattern based on cell value (Multiple conditions)

    That's good. Enjoy.

+ 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. [SOLVED] Set Cell Value Based on Multiple Conditions
    By BurkinaFaso in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-11-2015, 01:14 AM
  2. Macro to insert pattern based on value and select based on pattern
    By CB569 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-15-2015, 12:36 PM
  3. [SOLVED] Lookup and return rows based on pattern start and pattern end
    By JDI in forum Excel General
    Replies: 18
    Last Post: 11-16-2014, 11:44 PM
  4. Replies: 5
    Last Post: 04-28-2014, 07:54 AM
  5. Cell value based on multiple conditions
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-23-2010, 12:57 PM
  6. How do I change color pattern based upon a formula within a cell?
    By aemuk in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-16-2006, 06:25 PM
  7. Cell values based upon multiple conditions
    By Ryan M via OfficeKB.com in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 07-18-2005, 10: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