+ Reply to Thread
Results 1 to 6 of 6

Fill Random Cells With a Specified Color

  1. #1
    Registered User
    Join Date
    01-14-2013
    Location
    Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    3

    Fill Random Cells With a Specified Color

    I was wondering if anyone could help me out on the following problem.

    If Cell "c1" has a value of say 2 in it. I want a macro that will then Randomly fill 2 of 3 cells (say cells "f1", "f3","f5") with a specified color.

    Thanks in advance,
    edizzi
    Last edited by edizzi; 01-25-2013 at 01:46 PM.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Fill Random Cells With a Specified Color

    Hello edizzi,

    Welcome to the forum.

    You could use conditional formatting for this.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Registered User
    Join Date
    01-14-2013
    Location
    Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Fill Random Cells With a Specified Color

    Hello Winon,
    Thanx for the quick reply.

    I am not sure that conditional formatting will work. I have a macro running that updates the sheet every 60 seconds. What I want to happen is when c1 = 2 then cells "f1" and "f3" will be red and cell "f5" will be left blank, but when the other macro updates the sheet it will randomly reassign which 2 cells are red. So maybe then cells "f1" and "f5" are red and "f3" is blank. If you can understand what I am explaining lol.

    Thanks again,
    edizzi

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Fill Random Cells With a Specified Color

    Hello edizzi,

    You could still use conditional formatting for this, while the Macro updates the Data on your Sheet, Conditional Formatting will respond accordingly.

    Could you perhaps upload a sample WorkBook with your Code, if any, and I will show you how it is done!
    Last edited by Winon; 01-27-2013 at 04:54 AM. Reason: Corrected spelling

  5. #5
    Registered User
    Join Date
    01-14-2013
    Location
    Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Fill Random Cells With a Specified Color

    Hmmm now you have me intrigued Winon! I tried messing with conditional formatting to achieve my goal and could not quite get it to point I wanted. I am not sure how to upload a workbook on here. I am sure I am just overlooking it. When I get a little more time today I will figure out how to upload it and add it here. What I have done is use the Now()(cell a1) function with a Macro that updates the cell where the Now() function is located every minute. I then divide the time out in to hours and minutes (cells c1:f1). So you essentially have a clock once you kick the Macro off. Now if you can show me how to acheive the above with cell c1 the first 'hour' cell that would be awesome!Time xlforum.xlsm
    Thanks,
    edizzi

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Fill Random Cells With a Specified Color

    Hello edizzi,

    in Post #3 you state:
    What I want to happen is when c1 = 2 then cells "f1" and "f3" will be red and cell "f5" will be left blank, but when the other macro updates the sheet it will randomly reassign which 2 cells are red. So maybe then cells "f1" and "f5" are red and "f3" is blank.
    In your sample WorkBook, rows 3 to 5 are empty, which confuses me somewhat.

    I have applied examples of Conditional Formatting in the attached Sample WorkBook, for Cells C1 and F1, maybe you could use that to set it up the way you actually want it.
    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