+ Reply to Thread
Results 1 to 5 of 5

Autofill base on Active Cell and Autofill by row count of another sheet

  1. #1
    Registered User
    Join Date
    06-18-2014
    Location
    singapore
    MS-Off Ver
    2003,2010,2014
    Posts
    5

    Autofill base on Active Cell and Autofill by row count of another sheet

    Hi all,

    I'm new to excel vba, need some help with the codes.

    Information:
    3 sheets -1,2,3

    Need to count the number of row in sheet 3. Then in sheet 1, go all the way to the last row and autofill a range of cells (eg.A35 to G35 but row numbers may change, column remains the same). Auto fill all the way till the number of row in sheet 3 is the same.


    Sheets("3").Select
    Range("A1").Select
    numRows = Range(Selection, Selection.End(xlDown)).Rows.Count

    Sheets("1").Select
    Range("A1").End(xlDown).Select
    Selection.AutoFill Destination:=Range(******, Cells(numRows, 1)), Type:=xlFillDefault


    Thank you
    Last edited by enyak; 06-19-2014 at 04:14 AM.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,400

    Re: Autofill base on Active Cell and Autofill by row count of another sheet

    Does this work for you?

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    06-18-2014
    Location
    singapore
    MS-Off Ver
    2003,2010,2014
    Posts
    5

    Re: Autofill base on Active Cell and Autofill by row count of another sheet

    Sorry it didnt.

    In sheet 1 it suppose to start at A35 and autofill it downwards (data to be copied which is also the data of the last row = A35).
    Instead it messes up A33 and A34.

    Please advise, thank you very much!

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Autofill base on Active Cell and Autofill by row count of another sheet

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-18-2014
    Location
    singapore
    MS-Off Ver
    2003,2010,2014
    Posts
    5

    Re: Autofill base on Active Cell and Autofill by row count of another sheet

    I dont understand why instead of autofilling downwards, it goes upwards.

    Sheets("1").Select
    Range("A1").End(xlDown).Select
    Selection.AutoFill Destination:=Range(Cells(activecell.row,1), Cells(numRows, 1)), Type:=xlFillDefault

    while it suppose to autofill my cell from A35 to A36 A37 and so on...
    it autofills upwards causing my A33 and A34 cells to change.

    The current code I'm using.

    Sheets("3").Select
    Range("A1").Select
    numRows = Range(Selection, Selection.End(xlDown)).Rows.Count

    Sheets("1").Select
    Range("A1").End(xlDown).Select
    Selection.AutoFill Destination:=Range(Cells(ActiveCell.Row, 1), Cells(numRows, 1)), Type:=xlFillDefault

    Thanks guys, pls help..

+ 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. Macro for Autofill removes header info when there is no data to autofill
    By esturan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-06-2012, 01:42 PM
  2. Autofill based on Cell count?
    By treyUF in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2012, 02:27 AM
  3. Autofill when not active
    By bd528 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-15-2010, 05:40 PM
  4. VBA code to Autofill one cell to many rows below where row count will change
    By TrainingGoddess in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-27-2005, 11:06 PM
  5. Replies: 0
    Last Post: 03-02-2005, 12:06 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