+ Reply to Thread
Results 1 to 7 of 7

For Each Loop code issue

Hybrid View

  1. #1
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: For Each Loop code issue

    Try:
    Sub Color()
    ' Changes the cell color to correspond to the letter grade
    Dim Grade As Range, Cell as range
    Set Grade = Range("L16:L33")
    For Each Cell In Grade
      If Cell.Value = "A" Then
        With Cell.Interior
          .Pattern = xlSolid
          .PatternColorIndex = xlAutomatic
          .Color = 5287936
          .TintAndShade = 0
          .PatternTintAndShade = 0
        end With
      End If
      If Cell = "C" Then
        With Cell.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .Color = 65535
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    End If
    Next Cell
    End Sub
    Best Regards,

    Kaper

  2. #2
    Registered User
    Join Date
    05-05-2014
    Location
    Denver, CO
    MS-Off Ver
    O365
    Posts
    4

    Re: For Each Loop code issue

    Awesome, Thank you worked perfectly. It looks like the issue was defining Cell? I will add to your reputation

+ 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] Issue with For Each loop
    By ATLGator in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-16-2012, 09:01 PM
  2. For Loop Issue
    By pr4t3ek in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-12-2008, 10:40 AM
  3. Do while loop issue
    By Licquor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2008, 11:19 AM
  4. Loop issue
    By punter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2007, 03:18 PM
  5. [SOLVED] Issue with Do Loop
    By Linking to specific cells in pivot table in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-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