+ Reply to Thread
Results 1 to 3 of 3

VBA code for Formatting

  1. #1
    Registered User
    Join Date
    05-02-2005
    Posts
    9

    VBA code for Formatting

    I have a spreadsheet with 500 rows. I need the code to look through Column A for up to 10 conditions. For each condition it will color the row a different color.

    For example if A1 = Apple, Color the row Red
    A1 = Orange, Color the row Orange
    A1 = Banana, Color the row Yellow
    ....... and so on...

    Please help

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    here is a suggestion, turn on the macro recorder and color 10 rows the 10 colors you want the stop the recording. Then create a new macro which will be very simple.

    For i = 1 to 500 (or whatever your row range is)

    if cells(i,1).value ="apple" then cells(i,1).entirerow.Interior.ColorIndex =

    whatever colorcode you want

    next i
    not a professional, just trying to assist.....

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    You may find this link helpful

    http://www.excelforum.com/showpost.p...28&postcount=2

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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