+ Reply to Thread
Results 1 to 7 of 7

Using Case Statement for Conditional Formatting

  1. #1
    Registered User
    Join Date
    09-14-2014
    Location
    South Carolina
    MS-Off Ver
    Office 2013
    Posts
    9

    Using Case Statement for Conditional Formatting

    If this gets too complicated I am sorry in advance, Also if it cannot be done please advise.
    I am very new to VBA and am taking this over from someone that is no longer at company and very good at VBA.
    Essentially I have multiple worksheets that are used for data collection in manufacturing production enviroment ie (Cell Kiosks).
    Some have a workbook with worsheets for machine (8 max), while some have 3 sheets per machine to allow for changeovers.
    On all Sheets I have a drop down selection that decides what part is being checked on all sheets ($D$2).
    I want to use Case statements as this will make adding new parts much easier than Data Validation inside Excel. The Formula is so long it make my eyes twitch! As we have as many as 16 part numbers now with more to follow.
    I am currently getting a Object missing error. Can someone help and point me in right direction on this. Not sure if this should be done as a Module or Attach to each sheet involved.





    #
    Please Login or Register  to view this content.
    #


    On Range Select in second Case statement are where their reading are input.
    Much Thanks in advance.
    Last edited by SCHammer843; 09-15-2014 at 12:22 AM.

  2. #2
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Using Case Statement for Conditional Formatting

    Hi,
    Welcome to this forum...
    Try this..

    Please Login or Register  to view this content.
    However I don't know the Purpose of
    Please Login or Register  to view this content.
    So I didn't include it in the code.. if it matters then you have to explain its purpose to include it in the code..
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,997

    Re: Using Case Statement for Conditional Formatting

    code tags installed.
    Last edited by protonLeah; 09-15-2014 at 02:50 PM.
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    09-14-2014
    Location
    South Carolina
    MS-Off Ver
    Office 2013
    Posts
    9

    Re: Using Case Statement for Conditional Formatting

    Sorry was not clear the Case statement with TW10,.... is required to set groups of parts. On this workbook I believe there are 6 groups.
    So it would need to look like this i guess.....

    Please Login or Register  to view this content.


    On the a,b,c,d variables can they be rewritten like i have or have a separate variable for all combinations??
    Last edited by SCHammer843; 09-15-2014 at 08:32 AM. Reason: Clarification of code

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,997

    Re: Using Case Statement for Conditional Formatting

    Post a sample workbook (with the data validation formula)
    To attach a Workbook
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"

  6. #6
    Registered User
    Join Date
    09-14-2014
    Location
    South Carolina
    MS-Off Ver
    Office 2013
    Posts
    9

    Re: Using Case Statement for Conditional Formatting

    I have fumbled my way though and got code to work, however it keeps the same text color regardless of value unless re ran though VB editor, only sheet "Assy Part 1" and 1 group of parts have been programmed



    Please Login or Register  to view this content.
    Last edited by SCHammer843; 09-19-2014 at 10:45 AM. Reason: Add info

  7. #7
    Registered User
    Join Date
    09-14-2014
    Location
    South Carolina
    MS-Off Ver
    Office 2013
    Posts
    9

    Re: Using Case Statement for Conditional Formatting

    I finally got every thing to work in harmony

    Here's my syntax, Maybe it'll help some one else later on down road
    This Sub Selects one of many Part numbers
    Please Login or Register  to view this content.
    This one is the actual Conditional formatting of said part


    Please Login or Register  to view this content.

    The Weird Part was i had to add this on individual sheets to make Enter button work?

    Please Login or Register  to view this content.
    This forum is a very cool resource!

+ 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] Case sensitive conditional formatting.
    By KEP in forum Excel General
    Replies: 5
    Last Post: 06-19-2014, 08:52 AM
  2. [SOLVED] Using a blank cell as a conditional in a CASE statement
    By mattmickle in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-01-2014, 02:31 PM
  3. Excel 2007 : Conditional formatting-Case # Color
    By schulzc in forum Excel General
    Replies: 1
    Last Post: 09-06-2011, 08:18 PM
  4. case sensitive conditional formatting
    By Tel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-22-2006, 01:10 PM
  5. Select Case Conditional Formatting Sub?
    By RCW in forum Excel General
    Replies: 2
    Last Post: 02-05-2005, 07:06 PM

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