Results 1 to 7 of 7

Using Case Statement for Conditional Formatting

Threaded View

  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.





    #
    Sub CondFormatAssyP1()
        
        
        
         'Rivet Height
            Dim a As Double
            Dim b As Double
    
         'Rivet Diameter
            Dim c As Double
            Dim d As Double
            
        ActiveWorkbook.Activate
        ActiveWorkSheet.Sheets("Assy Part 1").Activate
        
      Select Case Range("D2")
        Case TW10, TW66, TW67, TW72
              a = 1
              b = 0.6
              c = 5
              d = 6.25
               
                Select Case Range("F9:M9")
            
                    Case Is > a
                    Cell.Text.Color = vbGreen
                    Case Is < a
                    Cell.Text.Color = vbRed
                    Case Is = Null
                    Cell.Text.Color = vbBlack
                    
                End Select
           
            Select Case Range("F10,H10,J10,L10")
                
                    Case c To d
                    Cell.Text.Color = vbGreen
                    Case Is < c
                    Cell.Text.Color = vbRed
                    Case Is = Null
                    Cell.Text.Color = vbBlack
                    
                
              
         End Select
      End Select
         
    'Next Set of Parts
    #


    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.

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. [SOLVED] 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