+ Reply to Thread
Results 1 to 6 of 6

Macro problem - copying specific cell's from one sheet to another

  1. #1
    Registered User
    Join Date
    02-11-2012
    Location
    Rijeka, Croatia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Macro problem - copying specific cell's from one sheet to another

    Hello everybody
    First, I would like to thank some people on this forum for their posts. Even I (and I don’t usually use excel that much) manage to solve some problems by myself (print button, save as button, locking and unlocking cell’s... etc) . But now I’m stuck and I really need your help. I’m working on some document for my company (complains report), and I’m trying to automate the whole procedure.
    Here is the problem: I have a workbook with two sheets. Sheet1 is a document where the user can type in the various data in unlocked cell’s, everything else is locked. After data input I’ve planned for user to have three buttons 1. Print button (PRINTAJ) – this button prints active worksheet (sheet1), and it works 2. Save as button (SPREMI ) – this button saves sheet1 to a specific folder (for now it is desktop) generating the name from two specific cell values, and it also works 3. Transfer data button (PREBACI PODATKE) – this button doesn’t work at all, and here I need your help.

    1. After inserting all necessary data in sheet1 user should click first on PRINTAJ, and print the document - working
    2. After they should click SPREMI, or save as button and save this file – working
    3. Third click is on PREBACI PODATKE, or data transfer button. With this click users should transfer specific (not all) unlocked fields from sheet1 into sheet2 and inform the user with a message that the “data was successfully copied”. After clicking OK on the message sheet1 should be empty and ready for user to type in new data in cell’s.
    4. Here is how the cell’s should be copied:

    Sheet1 Sheet2
    G7:I7 A4
    H4 B4
    I4 C4
    J4 D4
    F10:I10 E4
    E13:I13 F4
    E28:I28 G4
    F36 H4
    H36:I36 I4
    G44 J4
    E47:I47 K4

    When the procedure is repeated, next data from sheet1 should be copied in next free row (sheet2 from A5 to K5)... and so on, you get the point

    In my Macro1 I've tried with just three fields (H4, I4, J4)... any help would be greatly appretiated.
    Thank you in advance
    Mrgud

    TEST.xls

  2. #2
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Macro problem - copying specific cell's from one sheet to another

    Hi Mrgud,

    I think you will be able to move forward with your issue yourself

    you need only 2 things
    1) check first empty row in sheet2
    2) match source ranges from sheet1 and write values into sheet2 for new row

    so try to use something like this - of course complete below code with your ranges:
    Please Login or Register  to view this content.
    Please think about it - I writting reply directly online without testing in Excel
    Best Regards
    MaczaQ
    ---------------------------------------------------------------------------------------------------------------------------
    If you are satisfied with the solution(s) provided, please mark your thread as Solved
    If you are pleased with my answer consider to rate it. To thank someone who has helped you, click on the star icon below their name.
    - This way you will add him some reputation points ... thanks in advance.

  3. #3
    Registered User
    Join Date
    02-11-2012
    Location
    Rijeka, Croatia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro problem - copying specific cell's from one sheet to another

    Hi maczaq
    Thank you for your fast reply... I will try it and let you know the result.
    Bye

  4. #4
    Registered User
    Join Date
    02-11-2012
    Location
    Rijeka, Croatia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro problem - copying specific cell's from one sheet to another

    Good morning MaczaQ
    I've tried, but there is some error report... and I don't know why?! I think in first line of code ("FirstRow...)
    I'm not into this programming thing, but I like the challenges... for these first two button I've find the answer with a little bit of luck, a lot of reading and using a method of trial and errors
    But this third button is not a challenge to me any more, it's a nightmare.
    Thank you for trying
    Kind regards
    Davor

  5. #5
    Registered User
    Join Date
    02-11-2012
    Location
    Rijeka, Croatia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro problem - copying specific cell's from one sheet to another

    This is what I want... but I want to apply this probaMacro1.xls to TEST.xls
    Problem is that in probaMacro1 all date is in the same row and in TEST.xls they arent.probaMacro1.xls
    Please help.
    Mrgud

  6. #6
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Macro problem - copying specific cell's from one sheet to another

    Hello

    In probaMakro1 you have not marged cells so you can simpy copy and PastSpecial with transpose data, but in your main workbook "TEST.xls" you had few marged cells (i.e. F10:I10, E13:I13, E28:I28) so copy and pasteSpecial with transpose will return error because source date have other structure then destination range.

    I update your file TEST.xls with my idea - I hope You will enjoy it.
    Please Login or Register  to view this content.
    in attached file I update working example - I hope it is what you need
    Attached Files Attached Files

+ 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