+ Reply to Thread
Results 1 to 8 of 8

Fill Cell Colors for Selected range and Loop after 20 rows

  1. #1
    Forum Contributor
    Join Date
    06-01-2014
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Microsoft 365
    Posts
    224

    Question Fill Cell Colors for Selected range and Loop after 20 rows

    Hi All,

    I have to apply the following cell Background color to my selected range.
    Once the first 20 visible rows are filled I want to repeat the same colors again to the rest of my next 20 visible selection and so on.

    The applied colors will be:
    Interior Colors are:
    16764159
    65535
    6737151
    -4142
    39372
    16751052
    -4142
    15592877
    16760961
    16772300
    -4142
    7733109
    63140
    11796459
    -4142
    39501
    13491967
    Then Interior Shades
    -0.149998474074526
    -0.349986266670736

    How can I apply this loop and there are hidden rows i dont want to apply for, but only for visible rows.

    Thank you in Advance
    Attached Files Attached Files
    Last edited by ibuhary; 01-13-2022 at 06:28 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,902

    Re: Fill Cell Colors for Selected range and Loop after 20 rows

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    06-01-2014
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Microsoft 365
    Posts
    224

    Re: Fill Cell Colors for Selected range and Loop after 20 rows

    Hi
    I don't have any codes in my question.

    Thank you

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,902

    Re: Fill Cell Colors for Selected range and Loop after 20 rows

    Yes, you do. Anything starting 'Selection. is code. Please add the tags as instructed.

    Thanks.

  5. #5
    Forum Contributor
    Join Date
    06-01-2014
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Microsoft 365
    Posts
    224

    Re: Fill Cell Colors for Selected range and Loop after 20 rows

    I have removed those words now

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,902

    Re: Fill Cell Colors for Selected range and Loop after 20 rows

    OK, if that's the way you want to do it. It would have been far faster just to add the code tags, as instructed.

    I suggest you attach a sample workbook.

  7. #7
    Forum Contributor
    Join Date
    06-01-2014
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Microsoft 365
    Posts
    224

    Re: Fill Cell Colors for Selected range and Loop after 20 rows

    Attachment Done.
    Thank you for the Guidance.

  8. #8
    Forum Contributor
    Join Date
    06-01-2014
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Microsoft 365
    Posts
    224

    Re: Fill Cell Colors for Selected range and Loop after 20 rows

    I managed to complete the code,
    If anyone has an idea to make it short and sweet let me know : )

    The user manually selects the desired range (which may include hidden rows and columns) and runs the following code.

    Please Login or Register  to view this content.

+ 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. Loop through cells in selected range and delete file from path in cell
    By nordicdust in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-15-2019, 12:47 PM
  2. Store selected rows, then pass the row range to a With For Loop.
    By excelicus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2018, 07:30 PM
  3. Fill different Colors to different cell range
    By akynyemi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-19-2015, 09:54 PM
  4. Replies: 16
    Last Post: 12-12-2014, 06:19 AM
  5. Replies: 5
    Last Post: 07-16-2014, 07:46 AM
  6. Loop backwards through selected range - delete entire row from selected cells
    By scottbass in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2014, 09:21 AM
  7. Can't format font colors or cell fill-in colors
    By canoeron in forum Excel General
    Replies: 3
    Last Post: 08-22-2005, 07:05 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