+ Reply to Thread
Results 1 to 6 of 6

Macro to shade cells

  1. #1
    Registered User
    Join Date
    12-15-2010
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Question Macro to shade cells

    Hi Guys,
    I have this data in which Column A is category and Colomn B is the no. of Square cells to shade, the color for shading is defined by the corresponding color of category in column A. Right now, i am doing this manually, but the data i have to do this is getting out of hand. So, i will like to automate this with a macro, which will start with category in cell A2, read the no. of squares to shade in cell B2 and then go to cell G5 and shades the cells with the color, then go next category and do the same.

    I am attaching a dummy worksheet to show what i am doing, i have filled the example manually just to be clear.

    I really need to do some sort of macro for this. Any help will be really appreciated.

    Thanks.

    Roop
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Mcaro to shades defined no. of cells with a given color

    Hi,

    Make sure you have unlocked VBA.

    Try attached example.

    Best Regards
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-15-2010
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Mcaro to shades defined no. of cells with a given color

    Quote Originally Posted by maczaq View Post
    Hi,

    Make sure you have unlocked VBA.

    Try attached example.

    Best Regards
    Hi Maczag,
    I didn't see anyhting in th attachment, may be by mistake you attached a wrong file. Please take a look.

    Thanks.

    Roop

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro to shade cells

    maczaq's example can't have any code in it - *.xlsx files cannot contain macros.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Macro to shade cells

    sorry for that ... I attach wrong workbook, I will attach correct one (this evening) when I will come back to home ... because I haven't got it on this computer.

    Best Regards

  6. #6
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Macro to shade cells

    Hi,

    sorry for previous mistake
    In attached file now you will find working example

    and here is whole code
    Please Login or Register  to view this content.
    Best Regards
    MaczaQ
    Attached Files Attached Files

+ 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