Closed Thread
Results 1 to 10 of 10

Macro copy paste value between worksheets

  1. #1
    Registered User
    Join Date
    05-29-2017
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    6

    Macro copy paste value between worksheets

    Hi,

    I'm kinda new to Excel, so if someone could please help me.


    I want to write a macro which:

    If F43 on sheet 2 = 'x', then copy F43's 'x' to G324:330, G332:334 on sheet 4
    and then also copies text from H43 (sheet 2) to H324:330, H332:334 on sheet 4.


    Thanks in advance.
    -Absel
    Last edited by Absel; 05-29-2017 at 03:51 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Macro copy paste value between worksheets

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and click "manage attachments" to open the upload window.


    To add a file to a post

  3. #3
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,021

    Re: Macro copy paste value between worksheets

    Hi Absel

    Welcome to the Forum....
    Can give this a go:
    Please Login or Register  to view this content.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  4. #4
    Registered User
    Join Date
    05-29-2017
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    6

    Re: Macro copy paste value between worksheets

    Here's the file.
    Last edited by AliGW; 05-30-2017 at 04:20 PM. Reason: File attachment removed at OP's request.

  5. #5
    Registered User
    Join Date
    05-29-2017
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    6

    Re: Macro copy paste value between worksheets

    Hi sintek, thanks for the reply.

    This is something I've been looking for, but unfortunately, it doesn't work.
    As I said, I'm kinda new to Excel. I've done some stuff with VBA in Visual Studio before, so I know some things. However, Excel works quite differently.

    I tried to adjust it, so that it would work but with no positive result. This is the code now:

    Please Login or Register  to view this content.
    (*Note: I adjusted some cells and numbers to run properly with the uploaded file.)

    When this runs, it says "Compile error: A variable is not defined". When this error appears, "Sub CopyX()" is highlighted in yellow and "Sheet2 =" is highlighted blue (like when you highlight something with your mouse).

    What's wrong?
    Last edited by jeffreybrown; 05-29-2017 at 04:20 PM. Reason: Removed full quotes!

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,021

    Re: Macro copy paste value between worksheets

    No No No....Here you go:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-29-2017
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    6

    Re: Macro copy paste value between worksheets

    Thanks again for the quick reply, I tried it but again it didn't work. It says "Compile error: Types mismatch" : Macro.PNG

  8. #8
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,021

    Re: Macro copy paste value between worksheets

    Oh my word...I made a newbie error lol...Too hasty
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-29-2017
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    6

    Re: Macro copy paste value between worksheets

    sintek,

    Thank you very much! It works now, I really appreciate it. Will click on that fancy star button next to your post

    Thanks again!
    Last edited by jeffreybrown; 05-29-2017 at 04:19 PM. Reason: Removed full quotes!

  10. #10
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,021

    Re: Macro copy paste value between worksheets

    pleasure Absel, tx for rep

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro V Lookup copy and paste from different worksheets
    By Fredbugatti in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-17-2014, 02:49 AM
  2. macro which uses two worksheets at a time (copy and paste)
    By Manjula1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2014, 07:23 AM
  3. Macro to copy/paste between worksheets and other misc...
    By schaasyd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-30-2012, 08:47 AM
  4. VBA or Macro to Copy/Paste uniques value between 2 worksheets
    By grotz497 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-23-2012, 11:40 AM
  5. Copy/Cut/Paste Between Worksheets Macro
    By James479 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-07-2011, 06:10 PM
  6. Macro - copy/paste from different worksheets
    By emptycucumber in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2009, 06:20 PM
  7. Replies: 1
    Last Post: 10-17-2005, 04:05 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