+ Reply to Thread
Results 1 to 17 of 17

VBA to search for value and if it exists copy text from 4 cells into new cells

  1. #1
    Registered User
    Join Date
    01-25-2017
    Location
    Worcester
    MS-Off Ver
    2016
    Posts
    93

    VBA to search for value and if it exists copy text from 4 cells into new cells

    Hi,

    Please see the attached example.
    On Sheet 2 is a form created to amend data on sheet 1. The bottom right box on the form titled "Copy All Original Coding" needs to search column A on Sheet 1 when a number is entered into the box and the button pressed. I know the number will exist in column A because I will have already verified this, so when the button is pressed I need it to copy the data from cells H,I,J,K on that row to cells L,M,N,O on the same row.
    Screen shot.PNGScreen Shot 2.PNG

    Hope you can help me out.
    Attached Files Attached Files
    Last edited by smudgers9; 02-13-2019 at 12:20 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,668

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    Access to VBA is locked down with a password. Cannot provide any help without being able to access VBA.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    01-25-2017
    Location
    Worcester
    MS-Off Ver
    2016
    Posts
    93

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    Apologies @alansidman you're right. I have now removed the password protection.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,668

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    Unable to scroll to bottom of the form. Appears to be locked in place and will not allow me to see the entire form. Form does not appear to have been created in VBE. Cannot see a way to edit form.

  5. #5
    Registered User
    Join Date
    01-25-2017
    Location
    Worcester
    MS-Off Ver
    2016
    Posts
    93

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    @alansidman - I have frozen the panes as this will only be viewed on wide screen monitors which is why you can't scroll. The boxes are ActiveX control text boxes and the buttons are just shapes with macros assigned to them. This way I can design something that looks less "Excel" and more visually appealing. The module (8) has been created but I haven't created any code for it yet as I didn't even know where to start.

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    How about
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-25-2017
    Location
    Worcester
    MS-Off Ver
    2016
    Posts
    93

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    Thanks Fluff13, this gives me an error - Run-Time error '6':
    Overflow

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    What line was highlighted when you got the error & was that on the workbook you supplied?

  9. #9
    Registered User
    Join Date
    01-25-2017
    Location
    Worcester
    MS-Off Ver
    2016
    Posts
    93

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    Please Login or Register  to view this content.

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    And the answer to the other part of my question?

  11. #11
    Registered User
    Join Date
    01-25-2017
    Location
    Worcester
    MS-Off Ver
    2016
    Posts
    93

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    I added that exact code to module8 on the workbook I supplied you yes.

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    It worked for me.
    What number did you enter into the search box?
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    01-25-2017
    Location
    Worcester
    MS-Off Ver
    2016
    Posts
    93

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    Still doesn't work for me. I copy and paste (but have manually typed too) any of the numbers from column A.

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    Oops missed that bit, as you were copying the costings I thought you were looking for the Cost Center number
    Try
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    01-25-2017
    Location
    Worcester
    MS-Off Ver
    2016
    Posts
    93

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    Ah I see what you've done. If I enter any of the values in column H then it works. How do we do this for column A?

  16. #16
    Registered User
    Join Date
    01-25-2017
    Location
    Worcester
    MS-Off Ver
    2016
    Posts
    93

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    Amazing that works a treat. Thank you so much.

  17. #17
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: VBA to search for value and if it exists copy text from 4 cells into new cells

    You're welcome & thanks for the feedback

+ 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. Search for specific text then copy text into cells below
    By Locutos in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2018, 12:01 PM
  2. Replies: 3
    Last Post: 02-05-2018, 09:00 AM
  3. Replies: 6
    Last Post: 06-05-2015, 09:28 AM
  4. [SOLVED] Can someone help with a small macro? Search for Text and copy Text from cells
    By Sb1986m in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-20-2014, 07:19 AM
  5. Combine multiple text cells if value exists in other cells
    By epoch555 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-22-2014, 03:50 PM
  6. Search header row for common text in cells and copy below rows to new sheet
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-19-2011, 02:23 PM
  7. VBA: Search for text in database in copy cells within target rows
    By heuvel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2009, 10:50 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