+ Reply to Thread
Results 1 to 10 of 10

Match and change value of the cell

  1. #1
    Registered User
    Join Date
    04-06-2019
    Location
    Daventry, England
    MS-Off Ver
    2016
    Posts
    19

    Match and change value of the cell

    Hi all VBA masters Bellow you can see my part of code which is selecting cells for my report. One of the columns has name supervisor but the value is a number not name of supervisor...my question is how to change from number to name and surname. The list of the supervisors name must be in the different worksheet.




    Please Login or Register  to view this content.

    End Sub
    Last edited by SirMaceOne; 04-13-2019 at 07:41 PM.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Match and change value of the cell

    Assume the list of names is in sheet 2, Column A beginning in row 2 with the corresponding number in column B and the range with the number you want to find is in sheet2, Column A somewhere. To change all the numbers in column A sheet 2 to names.
    Please Login or Register  to view this content.
    Since you did not provide any information about where your data is located on the sheets, nor the sheet names, then you will need to adapt this code to your actual sheets and data.

    Also, this forum requires that you use code tags when posting code. You can edit your orignal post, select the code by highlighting it with the mouse pointer, then click the pound (#) symbol in the tool bar of the reply pane. Then click the "Post Reply" button.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    04-06-2019
    Location
    Daventry, England
    MS-Off Ver
    2016
    Posts
    19

    Re: Match and change value of the cell

    Hi JLGWhiz, Thanks for answer can you help change code...more details: source is in worksheet 'WOC' range A2:B16 column A = name of supervisor column B = number. Second worksheet name is 'CopyDataTheView' that is my main worksheet where I must change numbers. Supervisor numbers are in column H23 down to 200 rows.

  4. #4
    Registered User
    Join Date
    04-06-2019
    Location
    Daventry, England
    MS-Off Ver
    2016
    Posts
    19

    Re: Match and change value of the cell

    Hi JLGWhiz, Thanks for answer can you help change code...more details: source is in worksheet 'WOC' range A2:B16 column A = name of supervisor column B = number. Second worksheet name is 'CopyDataTheView' that is my main worksheet where I must change numbers. Supervisor numbers are in column H23 down to 200 rows.

  5. #5
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Match and change value of the cell

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-06-2019
    Location
    Daventry, England
    MS-Off Ver
    2016
    Posts
    19
    Quote Originally Posted by JLGWhiz View Post
    Please Login or Register  to view this content.

    thanks for help ... macro works but I have encountered another problem. When I added a macro to my workbook to the button when I want fill the table with the names I have to press the button a several times. Is it possible to make a loop ...

  7. #7
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Match and change value of the cell

    The macro does loop column B for each item of data starting in row 2 and working downward. What other loop did you want?

  8. #8
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Match and change value of the cell

    Maybe this is what you were looking for.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-06-2019
    Location
    Daventry, England
    MS-Off Ver
    2016
    Posts
    19

    Re: Match and change value of the cell

    Hi Big thanks for helping me...I have added macro from you to my workbook it is works like I want but with some error. I have prepared fake copy to show you what kind of problem I have. Code is clear for me but I don't understand where is the problem.
    Attached Files Attached Files

  10. #10
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Match and change value of the cell

    This should work better.

    Please Login or Register  to view this content.
    Or this one will be faster.

    Please Login or Register  to view this content.
    Last edited by JLGWhiz; 04-29-2019 at 11:34 AM.

+ 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] Using VBA to change the colour of a shape to match cell text
    By EdRooney in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 01-16-2019, 09:22 AM
  2. [SOLVED] Cell colour change to match that to its left
    By callummcgrath in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-21-2017, 09:32 AM
  3. [SOLVED] Change background colour to yellow if cell doesn't match the previous cell
    By drzeto in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-10-2017, 05:33 PM
  4. Change code to add 2 cell match then concatenate and sum
    By TAMMY32 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-11-2017, 01:46 PM
  5. Change Cell Value Based on INDEX/MATCH Criteria
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-10-2015, 11:42 AM
  6. Macro to match 2 values and change a corresponding cell value
    By Tbomb65 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2012, 09:53 PM
  7. Auto change one cell's fill to match another cell
    By spotta in forum Excel General
    Replies: 1
    Last Post: 06-12-2012, 07:34 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