Consulting

Results 1 to 3 of 3

Thread: Copy + Paste to Last Row based on Last Row of adjacent Column

  1. #1

    Copy + Paste to Last Row based on Last Row of adjacent Column

    I am running the code below to input info from multiple workbooks to one workbook with multiple worksheets,
    but I would like the auto-fill for column C to end in line with where the last data point in column A ends and not at C700.


    (Data in Column A varies in length i.e. number of rows with data varies from sheet to sheet).

    e.g. if the last data point in Column A is at A33, then Column C's last data point should be at C33.


    Your assistance is greatly appreciated.


    Parts of Code:


    lastRow = wsM.Range("C700").End(xlUp).Row + 2
    wsM.Cells(3, 3).Formula = "=A3/B3"
    wsM.Cells(3, 3).AutoFill Destination:=wsM.Range("C3:C700")

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    lastrow = wsm.Cells(Rows.Count, 1).End(xlUp).Row
    wsm.Cells(3, 3).Formula = "=A3/B3"
    wsm.Cells(3, 3).AutoFill Destination:=wsm.Range("C3:C" & lastrow)
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Awesome! Works perfectly. Thanx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •