+ Reply to Thread
Results 1 to 2 of 2

Copy macro/formula down a column, based on an adjacent cell

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    195

    Copy macro/formula down a column, based on an adjacent cell

    I have what I am sure is a simple query, I have a macro that runs a VLOOKUP from C5 to P5 and what I need it to do is then run the macro in the cells in the rest of the columns, but as I have just inserted a blank column to put my macro in, it goes and copies down to the end of the sheet, so I would need to specify the range to copy it down but only if there is something in the previous column.

    The column length will vary daily as the sheet is updated, so one day it needs to copy from C5:P5 to C500:P500 and the next day copy from C5:P5 down to C1000:P1000 and so on

    I have managed to get it to copy text down but not my Macro/formula

    Can anyone help please?

    Thanks

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Copy macro/formula down a column, based on an adjacent cell

    Hi, eoghanmolloy,

    you might consider to share the solution you found with other users as this thread is marked as SOLVED.

    Get the last row number of any column after inserting (assume you insert a Column in C get the last row in Column D) and use it as the upper limit for the loop:
    Dim lngLastD As Long
    lngLastD = Range("D" & Rows.Count).End(xlUp).Row
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ 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. [SOLVED] I need a macro to copy down till adjacent column ends in a blank cell
    By Paul Hayward in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2014, 02:27 PM
  2. VBA Macro to autofill data in column based on value on adjacent cell
    By cazantheman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2013, 02:04 PM
  3. [SOLVED] Macro to find the empty cell in a column and copy a adjacent row to another column.
    By naga in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-18-2013, 07:44 AM
  4. [SOLVED] macro to autofil formula based on number of rows on adjacent column
    By kramtelbuab in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-13-2013, 08:28 PM
  5. [SOLVED] Macro to Copy Formula Down Until Data in Adjacent Column Becomes Text
    By jcranst in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2012, 07:46 AM

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