+ Reply to Thread
Results 1 to 3 of 3

Macro VBA - Pasting to Varying Range

  1. #1
    Registered User
    Join Date
    02-04-2011
    Location
    Texas, USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Macro VBA - Pasting to Varying Range

    I am trying to copy values from "Formulas" , B2:O2 and paste them into cells on "Summary"

    The range on "Summary" will vary. It will always start with B2.
    The end depends on how many values are in column A.
    The current keystrokes are:
    1) End down in column A
    2) Right arrow, to navigate to column B
    3) Shift -> End -> up arrow -> down arrow, to highlight all column B cells with values in column A without the header row 1
    4) Paste

    The code below is the result of the full recorded macro. It is not dynamic, but using the relative reference seemed to be worse.

    How can we achieve the results we are looking for?

    Thank you... John


    ' This copies the formulas from Formulas to Summary
    Please Login or Register  to view this content.
    Last edited by pike; 02-04-2011 at 07:35 PM. Reason: add code tags for newbie PM warning

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Macro VBA - Pasting to Varying Range

    hi jbrad627

    welcome to the forum

    Please Login or Register  to view this content.
    this copies the "B2:O2" and pastes it to the last row in summary sheet
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    02-04-2011
    Location
    Texas, USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Macro VBA - Pasting to Varying Range

    Pike, thank you for the reply. I tested the code and it is not exactly what we need for this, but I can use it in another project, so thanks.

    For this one, sorry if my original post was confusing. I will try to be a little clearer.

    There is a previous process that deletes everything from each sheet but the header.
    Then another process pastes in the day's values into column a on Summary.
    The number of records can vary.
    One time it might be from A2:A3108, the next it might be from A2:A3200, and then A2:A3000, etc.
    We now need to select and copy the formulas on Formulas B2:O2 to the rows with values in Summary, column a.
    In the above examples, one time the range would be B2:B3108, then B2:B3200 and then B2:B3000, etc.
    It always starts with B2, however the ending row varies.

    Thank you

    John

+ 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