Excel VBA to filldown filled range by n rows

Posted on 2011-05-03
Last Modified: 2012-05-11
How do I have to amend the code below to fill down the last non-empty row by n (DailyRowsToInsert) rows?
LastRow = Range("A" & Rows.Count).End(xlUp).Row
LastColumn = Cells(LastRow, Columns.Count).End(xlToLeft).Column

TargetWsDaily.Range("A" & LastRow & ":" & LastColumn & LastRow).FillDown

ActiveCell.Resize(LastRow, LastColumn).Copy Range(Cells(LastRow + DailyRowsToInsert, 1), Cells(LastRow, LastColumn))

Open in new window

Question by:stmoritz
    LVL 39

    Accepted Solution


    TargetWsDaily.Cells(LastRow, 1).Resize(DailyRowsToInsert, LastColumn).FillDown

    Open in new window


    Author Closing Comment

    perfect. thanks a lot.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
    This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
    This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now