+ Reply to Thread
Results 1 to 6 of 6

Userform for date entry and then copy/paste matching data to another sheet

  1. #1
    Registered User
    Join Date
    03-16-2013
    Location
    DK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Userform for date entry and then copy/paste matching data to another sheet

    Hi all

    Totally VBA newbie here, but found a thread where I could benefit a little from another users file.
    http://www.excelforum.com/excel-prog...r-sheet-2.html

    "Distribution List Testing.xls"

    I have edited a little in the code to fit my need, but I am coming up short at the copy/paste part..

    I have managed to get my 2 top rows on the first sheet "oversigt" copied over to the new sheet, but even though I have several rows containing dates within my interval, none of these rows are copied over to my new sheet..

    On sheet 3 "VARIABLE" I have inserted a button to run the macro "main" which starts the userform

    Afregning010513-test.xlsm

    I simply cannot figure out what I need to change in the code to actually have the selected rows copy/pasted into the new sheet.

    I hope I have explained it well enough, but if I haven't, then plz let me know and I will try to explain it better..

    PS.. Spreadsheet is mainly in Danish, so if you don't know what something means, I'll translate..

    Regards
    Henrik Nymann

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Userform for date entry and then copy/paste matching data to another sheet

    Hi

    I've reworked the sub to use an advanced filter instead of the loop. When I opened the form, I used the dates 1/5/2013 and 2/5/2013

    See how it goes.

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    03-16-2013
    Location
    DK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Userform for date entry and then copy/paste matching data to another sheet

    Hi Rylo
    Thanks for the quick answer..

    Now I get the right data copied over to the new sheet in column A, B, C, D, E, I, J, K, L & N..
    However in columns M & O its is not the correct value (price) it copies over.. (Could this perhaps be because the cells in row 1 in columns (L & M) & (N & O) are merged..??)

    Or is it because of something else..??

    If you look at this example (file) I tried to copy/paste the date 30-04-2013 (Sheet 2).. I get 3 lines copied which is correct, but as U can see not all columns in the output are matching the original..

    // Henrik

  4. #4
    Registered User
    Join Date
    03-16-2013
    Location
    DK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Userform for date entry and then copy/paste matching data to another sheet

    Hmm..

    Just tested it again to see if unmerging the cells had any effect but unfortunately not..

  5. #5
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Userform for date entry and then copy/paste matching data to another sheet

    Hi

    Just had a look and realised that you have multiple column headings that are the same (columns K, M and O). Didn't realise that when I did the code.

    Can you change the column headings in M and O so all 3 are unique, and see if that brings back the required prices.

    rylo

  6. #6
    Registered User
    Join Date
    03-16-2013
    Location
    DK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Userform for date entry and then copy/paste matching data to another sheet

    Arh...

    You are so right...

    Just tested again, at it looks perfect now..

    Thank you very much

    // Henrik

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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