+ Reply to Thread
Results 1 to 3 of 3

Simple Macro Stuff - changing autofill

Hybrid View

  1. #1
    Registered User
    Join Date
    11-13-2006
    Posts
    2

    Wink Simple Macro Stuff - changing autofill

    Hi

    I am learning the basics of macros and am constructing a macro to format a spreadsheet. In the extract below my macro is filling a formula down on a range of cells R2:R54, unfortunately the number of rows varies from day to day so I would like to change this phrase so it fills down column R exactly how many rows are populated in column Q to the left hand side (or any other column from A onwards) so it fills down the correct depth every day

    Selection.AutoFill Destination:=Range("R2:R54"), Type:=xlFillDefault

    Hope someone can advise on what is quite a basic question

    Kind Regards
    Austin

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by AUSTIN1
    Hi

    I am learning the basics of macros and am constructing a macro to format a spreadsheet. In the extract below my macro is filling a formula down on a range of cells R2:R54, unfortunately the number of rows varies from day to day so I would like to change this phrase so it fills down column R exactly how many rows are populated in column Q to the left hand side (or any other column from A onwards) so it fills down the correct depth every day

    Selection.AutoFill Destination:=Range("R2:R54"), Type:=xlFillDefault

    Hope someone can advise on what is quite a basic question

    Kind Regards
    Austin
    Hi,

    something along the lines of

    qLastRow = ActiveSheet.Range("Q65536").End(xlUp).Row

    then

    Selection.AutoFill Destination:=Range("R2:R" & qLastRow), Type:=xlFillDefault

    should suffice.

    hth
    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Registered User
    Join Date
    11-13-2006
    Posts
    2
    thx very much

+ Reply to Thread

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