+ Reply to Thread
Results 1 to 8 of 8

Copy Range from Sheet A then find the next empty row in sheet B

  1. #1
    Registered User
    Join Date
    09-30-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    30

    Copy Range from Sheet A then find the next empty row in sheet B

    Hi

    I want to do something that seems easy at first but im getting myself confused,

    So what I want to do is add data into Sheet A each day then press a button which will copy the data in a range and paste it into Sheet B, but I want to create a list of all data so I need it to find the next empty cell and start the paste from there (if that makes sense).

    I want it to create a data base on one sheet from a daily import, I have a code to copy one cell to next empty cell but dont know how to duplicate it to a range.

    I hope I have given you enough info this is what I have done so far

    Public Sub CopyData()
    Dim ws As Worksheet, bi As Byte, vData(1 To 1)
    Set ws = Sheets("A")
    For bi = 1 To 1
    vData(bi) = Application.Choose(bi, ws.Range("A1"))
    Next bi
    Sheets("B").Cells(Rows.Count, "B").End(xlUp).Offset(1).Resize(, 1).Value = vData
    Set ws = Nothing
    End Sub

    Thank You

  2. #2
    Registered User
    Join Date
    09-30-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Copy Range from Sheet A then find the next empty row in sheet B

    can I be cheeky and add another thing onto it, because I need to know the date of the import is there a way I could add "todays" date next to the newly pasted info?

    thanks

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Copy Range from Sheet A then find the next empty row in sheet B

    Hi,

    If you apply a dynamic range name (say 'MyImportData') to your sheet A imported data then all you need is (untested)

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    09-30-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Copy Range from Sheet A then find the next empty row in sheet B

    Hi Richard

    thanks for replying :-) I'm still new to the VBA world knicked the above from another thread how would I add that into my code or what amendments would I need to make to it to add this in

    thank you

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Copy Range from Sheet A then find the next empty row in sheet B

    ...
    Preface the previous code with

    Please Login or Register  to view this content.
    If the number of imported columns never changes then simplify it by substituting the number of columns for the "Range("MyImportData").Columns.Count" instruction.

  6. #6
    Registered User
    Join Date
    09-30-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Copy Range from Sheet A then find the next empty row in sheet B

    that code on it's own worked perfectly! thank you so much

    my next step is to try and add a unique reference to the newly pasted info so I can compare one set against another, so I have a load of job numbers each day and I want to calculate if any have been completed (by not being on the second list) and any that are new ( not on the list before). I can calculate that with a formula but how would I add the imported date to the cell next to it? just on the newly added section, a bit of a shot in the dark really

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Copy Range from Sheet A then find the next empty row in sheet B

    Hi,

    Not quite sure what you're getting at. If you can upload the workbook and manually add the data you want added then it may be a little clearer.

    In principle though you'd use an =MATCH() function to identify whether a particular value in one range exists anywhere in another range.

  8. #8
    Registered User
    Join Date
    09-30-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Copy Range from Sheet A then find the next empty row in sheet B

    It's alright mate I'll add the date into the data range then copy that over add the paste value into the code,

    Thanks for your help richard I've added reputation as a thanks :-)

+ 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] Macro to Copy Range and Paste in the Empty Row Same Sheet
    By kaurka in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-22-2013, 11:01 AM
  2. Replies: 1
    Last Post: 04-22-2013, 10:34 AM
  3. Copy data from one sheet to another in the first empty column in a given range
    By timisoara in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-16-2013, 10:53 AM
  4. Find value in a certain range and then copy to an other sheet
    By Rysioslaw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2012, 10:23 AM
  5. Copy fields from sheet to sheet only if not empty and only on-demand
    By Powrpak in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-17-2008, 10:23 AM

Tags for this Thread

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