Results 1 to 4 of 4

Copy value & fill color and fill dynamically to last row of data

Threaded View

  1. #1
    Forum Contributor Webbers's Avatar
    Join Date
    09-06-2005
    Location
    Poinciana, FL
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    337

    Copy value & fill color and fill dynamically to last row of data

    Okay this is just so simple, but I cannot figure out how to do it. I tried the macro recorder, and aside from the garbage it produced, it had a defined range. The macro should place the X in cell CG1 and add the background color, then fill down to the last row of data. If a "helper" column is needed to determine what the last row is, that would be column C.

    1. I would like to use this macro for the Active worksheet (it will be used multiple times)
    2. The # of rows is dynamic (based on the sheets as well as each week the amount of data varies)
    3. The only content an X for the value in the cell and the fill color in Column CG
    4. The color index is 44 (orange), which I believe is the same as this: .Color = 49407 (either can be used)

    This is my recorded code. The macro works, the problem is the static range. This will not allow me to use it for multiple sheets, and the number of rows is different every week. Thanks in advance!

    Sub test()
    
        Range("CG1").Select
        ActiveCell.FormulaR1C1 = "X"
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 49407
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
        Selection.AutoFill Destination:=Range("CG1:CG6777")
        Range("CG1:CG6777").Select
        Range("CG1").Select
    End Sub
    Last edited by Webbers; 08-06-2019 at 10:51 AM. Reason: added code
    ~*~ Sherry ~*~
    Poinciana, FL

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dynamically Create Sheets and Copy Data
    By racer25 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-23-2018, 09:55 AM
  2. VBA Copy Row on Match Data in Two Columns Dynamically
    By AaronSillars in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2015, 10:27 PM
  3. Dynamically apply filter and copy data and paste in another file
    By iamronakjain in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2014, 09:25 AM
  4. Macro to dynamically select and copy data from different sheets and columns
    By Gr8tDaze in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2013, 07:32 PM
  5. [SOLVED] Open file dynamically and copy data using advanced filter
    By 4gurus in forum Excel General
    Replies: 4
    Last Post: 09-11-2013, 07:06 AM
  6. How to dynamically fill inn data i first available row in list
    By tnuis in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-25-2013, 02:42 PM
  7. fill in table dynamically
    By xlepws in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-16-2012, 03:37 PM

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