Results 1 to 3 of 3

Dynamic Auto-Fill Range based upon Specific number of rows

Threaded View

a333 Dynamic Auto-Fill Range based... 04-01-2013, 03:56 PM
dilipandey Re: Dynamic Auto-Fill Range... 04-02-2013, 03:18 AM
arlu1201 Re: Dynamic Auto-Fill Range... 04-02-2013, 03:54 AM
  1. #1
    Registered User
    Join Date
    12-17-2012
    Location
    Boston
    MS-Off Ver
    Excel 2003
    Posts
    3

    Question Dynamic Auto-Fill Range based upon Specific number of rows

    Hi - I am trying to create a macro that will select the last row of cells in column CA:EH and drag them down through the previous quarter end. To do this I have created a function to get the number of rows the data must be pulled down called weekCount.

    However, I am having an issue with coding the AutoFill range. I think that it's getting confused between row or select. I'm also not sure that I formatted the AutoFill range correctly for this scenario. Can someone please take a look at the code below?
    Sub Update()
    Dim zRow As String
    Dim dropspot As String
    Dim firstrow As String
    zRow = "CA7"
    
          
    'brings us to last cell with values in column CA
        Range(zRow).Select
        Range(Selection, Selection.End(xlDown)).Select
        dropspot = Range(zRow).End(xlDown).Select
        
    'selects the portion of data that must be computed for the recent quarter
        firstrow = Range(Selection, Selection.End(xlToRight)).Select
        
    'auto-fills cells downward
        Selection.AutoFill Destination:=Range("CA:EH" & weekCount.row), Type:=xlFillDefault
        
    'updates numbers in dragged down cells
        Calculate
        
    'copies and pastes special values data from new pulled down cells except for last row
    'need to make these ranges dynamic still
        Range("CA1734").Select
        Range(Selection, Selection.End(xlToRight)).Select
        Range(Selection, Selection.End(xlDown)).Select
        Range("CA1734:EH1741").Select
           Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            
    End Sub
    Last edited by arlu1201; 04-02-2013 at 03:53 AM.

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