+ Reply to Thread
Results 1 to 5 of 5

Code to search a cell for a value. If it is there, Copy and paste data from another sheet

  1. #1
    Registered User
    Join Date
    04-20-2014
    Location
    London
    MS-Off Ver
    Windows Excel 2010
    Posts
    79

    Code to search a cell for a value. If it is there, Copy and paste data from another sheet

    Hi guys

    I have two sheets I am working from.

    If Cell D3 (In Sheet 1) has the word "Internet" as the value, I would like the VBA code to copy and paste the cells B2 and C2 from another sheet (Sheet 2) into G3 and H3 of Sheet 1.

    Here is the code I have so far. It is very strange as it worked ONCE and no longer works :S.

    Please Login or Register  to view this content.
    Can anyone help me with this?

    Btw I would also like to repeat this worksheet change if the value is say "Newspaper" then it would copy the values from Sheet 2 B3 C3.. and so on and so forth. Do I just repeat the code using an Else If?

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Code to search a cell for a value. If it is there, Copy and paste data from another sh

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-20-2014
    Location
    London
    MS-Off Ver
    Windows Excel 2010
    Posts
    79

    Re: Code to search a cell for a value. If it is there, Copy and paste data from another sh

    Thank you so much for this code it is very helpful!

    Is there a way I can input a questioning line to this. So once it identifies the value it can ask "Would you like to insert Internet objectives".

    This adds an element of decision instead of the data automatically being copied to G3:H3?

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Code to search a cell for a value. If it is there, Copy and paste data from another sh

    Sure. You can just add a message box and ask for confirmation. I'm not quite sure how you want to impliment this but here is an example:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-20-2014
    Location
    London
    MS-Off Ver
    Windows Excel 2010
    Posts
    79

    Re: Code to search a cell for a value. If it is there, Copy and paste data from another sh

    I have now used your code and applied it to multiple sheets however for the life of me I can't get the code to perform the following function

    1) When the data is copied over I would like the row of information that is PASTED into the respective sheet to be UNHIDDEN.

    the reason for this is that all rows that do not contain information in any sheet is hidden. When the information is pasted in I would like that row to be revealed.



    Please Login or Register  to view this content.

+ 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. VBA code to search from different sheet > Copy the row > Paste on different sheet.
    By qpywsqp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2013, 11:13 AM
  2. Replies: 1
    Last Post: 03-28-2013, 02:49 PM
  3. [SOLVED] Code to search a cell, copy and paste
    By MDEN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2012, 05:19 AM
  4. Replies: 2
    Last Post: 10-15-2009, 10:12 AM
  5. Macro to search the sheet name and copy and paste the data from a major sheet
    By salma2009 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2009, 02:11 AM

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