+ Reply to Thread
Results 1 to 14 of 14

Find string-value and add value in next cell

  1. #1
    Registered User
    Join Date
    08-11-2016
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    7

    Find string-value and add value in next cell

    Hi

    Its a long time since ive been making macros but now i need one. I got 2 excel-documents. 1 document got the names, address and got a worksheet for each group of people and the other document got name and userID. I need to get the first document to also include userID in every worksheet.
    Basically i want the macro to check the name-cells, copy the value of the cell next to the namecell which got the userID, and then find the correct name and add a new cell with userID next to it for every worksheet.

    Ive got something on this guide: http://www.thespreadsheetguru.com/th...nd-replace-all
    but its not good enough. Does it work to copy names and userID into a temporary array and use that for every worksheet? Or do i need to copy the nakes and userID into the excel-document and then run a new macro to compare names and then add userID when it finds similar names?
    Can someone help? Is this possible?

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,081

    Re: Find string-value and add value in next cell

    Can you post a copy of both files? It would be easier to test suggested code on the actual data.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    08-11-2016
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    7

    Re: Find string-value and add value in next cell

    http://www.filedropper.com/groups_3
    http://www.filedropper.com/navnelisterrapport1

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,081

    Re: Find string-value and add value in next cell

    I have to go out for a few hours now. I will look at your files when I return and provide you with some feedback.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,081

    Re: Find string-value and add value in next cell

    Place the following macro in a regular module in the 'groups' file and 'SaveAs' a macro-enabled file so that it's extension is changed to "xlsm". Next, make sure that both files are open and then run the macro.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-11-2016
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    7

    Re: Find string-value and add value in next cell

    Thank you so much! This works perfect.

    Im gonna ask for one more thing. Is there a way i could also combine the sheets in the group-file?
    First run the macro. Then another macro to get 2-3 columns into 1 single worksheet. The original document has got very many sheets you see.

  7. #7
    Registered User
    Join Date
    08-11-2016
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    7

    Re: Find string-value and add value in next cell

    Ive found this code on http://www.rondebruin.nl/win/s3/win002.htm but can get it to work correct. First i get error on "Last = LastRow(DestSh)" Not defined etc Then i ge anopther error for pasting in. Combined cells new same value.
    And another thing, in the new sheet i want the title of the sheet whichs its copied from to get in a new row so i see where it gets it value from
    )
    Please Login or Register  to view this content.

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,081

    Re: Find string-value and add value in next cell

    Which columns from each sheet do you want to combine into one sheet?

  9. #9
    Registered User
    Join Date
    08-11-2016
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    7

    Re: Find string-value and add value in next cell

    Quote Originally Posted by Mumps1 View Post
    Which columns from each sheet do you want to combine into one sheet?
    I need the names from G, and the number from I along with the name of the sheet. Doesnt matter if its more columns.
    Actually got this code to work. But because of the format of the file its not 100%. Some columns look weird but basicly it gets the job done.
    Please Login or Register  to view this content.
    Along with functions
    Please Login or Register  to view this content.

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,081

    Re: Find string-value and add value in next cell

    Try this macro:
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-11-2016
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    7

    Re: Find string-value and add value in next cell

    Thank you for your help! I was also wondering if i could get the value from cell B4 from each worksheet into the Summary-sheet for each line.
    Ive tried something but the macro loops for each worksheet so i get the B4 value into the Summarysheet under column D but it doesnt copy the value.
    I want it to copy the value for each row, not only for each worksheet. Hard to explain but i shortly i want the value of B4 in each worksheet beside the name of the worksheet in column D in the summary-sheet.
    Is that possible or do i need a totally new macro which loops on a different value then worksheets?

  12. #12
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,081

    Re: Find string-value and add value in next cell

    I tried to download your files from the links you posted in Post# 3 but the links no longer work properly. I'm having a little trouble following what you would like to do. In your file, could you include a sample sheet that contains what you want the end result to look like?

  13. #13
    Registered User
    Join Date
    08-11-2016
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    7

    Re: Find string-value and add value in next cell

    Quote Originally Posted by Mumps1 View Post
    I tried to download your files from the links you posted in Post# 3 but the links no longer work properly. I'm having a little trouble following what you would like to do. In your file, could you include a sample sheet that contains what you want the end result to look like?
    Ive sent you and private message but im gonna give you a image of how i want the Summary-sheet to look like in this post as well.
    Excel.JPG

  14. #14
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,081

    Re: Find string-value and add value in next cell

    See if this works for you:
    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. [SOLVED] Can I use FIND function to find specific string in a single cell?
    By bonpara in forum Excel General
    Replies: 2
    Last Post: 10-05-2015, 05:46 PM
  2. Find a string withing cell range and return cell number
    By visak in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-16-2015, 09:19 PM
  3. [SOLVED] Find a string in cell with multiple values based on number in another cell
    By ccantara in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-03-2015, 03:29 PM
  4. [SOLVED] Vlookup, Match (Search or Find) partial string within string in a Cell
    By dluhut in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-28-2013, 12:40 PM
  5. [SOLVED] VBA Needed to find number/text within cell string and copy out to new cell
    By Campbell A in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-19-2013, 10:15 AM
  6. how to find Certain String in a column, select/Copy the cell till another String
    By excelkeechak in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-18-2009, 10:59 AM
  7. [SOLVED] Find a String in a Cell
    By jerry chapman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2005, 01:06 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