+ Reply to Thread
Results 1 to 3 of 3

VBA to add x amount of rows with alternate color

  1. #1
    Registered User
    Join Date
    01-30-2015
    Location
    winnipeg
    MS-Off Ver
    2010
    Posts
    2

    VBA to add x amount of rows with alternate color

    Hi excel help,
    I'm looking for a VBA that would allow me to add X amount of rows and those rows would be alternate highlighted between light gray and white. So for example if i clicked the macro a box would pop up asking how many rows i need and if i entered 20, then i would populate 20 rows all alternately coloured (even grey, odd white, except the top row). Thankyou so much in advance.

    Johnny

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA to add x amount of rows with alternate color

    Hi Johnny,

    Welcome to the Forum!

    Try this:

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    If you haven't used macros before you'll need to go to your options - trust center -trust center settings - macro settings
    , the second option down (disable all macros with notification)

    Then - Copy the code to the clipboard

    Open your Workbook

    Press ALT + F11 to open the Visual Basic Editor.

    Select "Module" from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    01-30-2015
    Location
    winnipeg
    MS-Off Ver
    2010
    Posts
    2

    Re: VBA to add x amount of rows with alternate color

    thank you very much for your speedy reply. I will try this right away.

+ 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] Color Alternate rows with count
    By jtmeunier in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2013, 07:44 PM
  2. Replies: 6
    Last Post: 10-01-2012, 10:52 AM
  3. Lowest amount among three alternate cells
    By ahsk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2010, 06:12 PM
  4. Alternate Shading (fill color) every three rows
    By jeaux11 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 02-08-2008, 04:42 AM
  5. Alternate Row Color Style
    By freem123 in forum Excel General
    Replies: 2
    Last Post: 04-07-2006, 07:15 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