+ Reply to Thread
Results 1 to 16 of 16

Finding copying and pasting

  1. #1
    Registered User
    Join Date
    05-04-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    12

    Smile Finding copying and pasting

    For my job I have to do every day a search for a specific text "RFS" in the "H" column then copy the whole row and paste it in a sheet called deposits below all of the other deposits, a friend told me it could be done in Visual Basic to make it automatic but I don't know how it could be done, I have very little Visual Basic skills I'll appreciate any suggestions

    Thank You

  2. #2
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Finding copying and pasting

    Hi Lauren,

    If you'll post a sample workbook stripped of sensitive information, we can get you going. Otherwise, a few questions:

    1. Does "RFS" appear in H as a standalone string, or within/in combination with other alphanumeric characters (e.g. H2013RFSZX)?
    2. What is the name of the sheet containing the "H" column to be searched?
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Finding copying and pasting

    Here's a first run. Please report back results. Instructions for use included at the top of the code, and in my signature. You will need to change the name of your "search" worksheet as indicated in green in the code.

    Please Login or Register  to view this content.
    If there are "gaps" in the data in Column "H", use:
    Please Login or Register  to view this content.
    instead of
    Please Login or Register  to view this content.
    Last edited by AlvaroSiza; 05-05-2013 at 02:20 PM. Reason: Additional functionallity

  4. #4
    Registered User
    Join Date
    05-04-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Finding copying and pasting

    Thank you so much!!
    It does work perfectly :D
    but I need one more thing bc I forgot to mention that the row containing the "RFS" should be removed from the "sheet1" when it goes to the "Deposits" sheet
    I really appreciate it

  5. #5
    Registered User
    Join Date
    05-04-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Finding copying and pasting

    I need one more thing bc I forgot to mention that the row containing the "RFS" should be removed from the "sheet1" when it goes to the "Deposits" sheet
    I really appreciate it

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Finding copying and pasting

    As an option

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-04-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Finding copying and pasting

    Hey I was using it but since my "sheet1" has headers and cuts them and pastes them in "deposits" as well so it makes it hard for me to work with is there an easy way to not select the headers or how can the code be improved so that doesn't happen again??

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Finding copying and pasting

    Change

    Please Login or Register  to view this content.
    INTO

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-04-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Finding copying and pasting

    It keeps taing one more row than it should, when copying it copies all the RFS plus the one above which is the "filtering" row

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Finding copying and pasting

    Use this line

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    05-04-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Finding copying and pasting

    I haven't been able to insert it in a place where it works, can you post me the whole Macro Please?/

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Finding copying and pasting

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    05-04-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Finding copying and pasting

    Hi thanks for your quick reply, I used that one but the code just copies the H column, but I wanted to get all the row or at least the 8 cells that are in the rows that contain "RFS" in their "H" column I hope its not hard to do

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Finding copying and pasting

    The code should copy all rows which have "RFS" in column H unless you have a list(Table)

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    05-04-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Finding copying and pasting

    Thank You Very Much this is exactly what I needed you sir are an angel!!

  16. #16
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Finding copying and pasting

    Lauren,
    You are welcome!
    Could you please now mark the thread as "Solved"

+ 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