+ Reply to Thread
Results 1 to 13 of 13

Excel VBA: Count Part Numbers which are the same and be able to replace the price all of

  1. #1
    Registered User
    Join Date
    12-06-2017
    Location
    Hungary
    MS-Off Ver
    2016
    Posts
    43

    Excel VBA: Count Part Numbers which are the same and be able to replace the price all of

    Hi,

    I have a little problem and I could use some help.
    The task is as follows:
    I calculate some price list with VBA already that includes product number, product name and price. (Its generated into an excel worksheet) This can be quite a lot of rows. If I want to change the price later, I'll have to manually search all the product numbers and writing the same price there. (There cant be different prices for the same product number)
    I would like a VBA code for this to make it faster. I've found it that "dictionary" has some functions which I need, but can not figure it out.
    Here is the code I've been had so far, but it does not exactly work the way I want it.
    Please help me because I'm stuck!

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Narozsnikz; 02-05-2018 at 05:39 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    1)
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.
    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    2)
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    12-06-2017
    Location
    Hungary
    MS-Off Ver
    2016
    Posts
    43

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    Hello,

    Thanks I reedit my post!

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    Thanks for the edit.

    I don't understand what you are trying to do.
    Can you upload a workbook with before/after clearly showing the logic behind it?

  5. #5
    Registered User
    Join Date
    12-06-2017
    Location
    Hungary
    MS-Off Ver
    2016
    Posts
    43

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    Can you open the workbook which I uploaded?
    If so then the "Konfig" Sheet contains the price quotation which i send out to my clients (I have VBA codes to generate this and codes to export it to pdf so the user only sees what they need, which is column B-G range).
    On the column B there is the "part number" while column C contains the name and the E is the price of that part excepet the rows which contains the "PCT Blade" name, the price in these rows are the sum of the parts below.
    My problem is if I want to change one of the parts prices for example this (Row10):
    SZGRK-PC1HDD1_A-170322 500GB 3,5" HDD belső merevlemez 1 11 163 Ft

    If I change the 11.163 Ft to something else, like 10.000 Ft, than after this I need to manually looking for all the same part number "SZGRK-PC1HDD1_A-170322" becouse the same part numbers cannot have different prices when I sent this out. If the same part number has different price than my price quotation is wrong and I will be disqualified from the competition. (i cannot find the proper english word, but hope its understandable.
    So this part number is again in Row 24, and in row24 I need to manually change the price to be also 10.000. In this case its not a big deal, but there are times when this list is quite a few hundred lines whit lots of similar part numbers everywhere and looking and chaning manually its a really painful job.
    I'm thinking about a listbox or combobox, that appears after a button is pushed, and that gives meg something like this
    Part Number
    SZGRK-PC1HDD1_A-170322 occurs 8 times current price "11.163" The New Price? "input"
    SZGRK-PC1RAM1_A-170322 occurs 3 times current price "9.086" New Price? "Input"
    and when I hit okay it changes all in the worksheet.
    So this is understandable what I would like to do?

  6. #6
    Registered User
    Join Date
    12-06-2017
    Location
    Hungary
    MS-Off Ver
    2016
    Posts
    43

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    Maybe it can be done easier with Sub Worksheet_Change which is looking the price column and after that is changed its looking for the same part number and offer an inpubox to change to the same price. Im thinking.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    So Col.C is nothing to do with the change?

    This is how I understand...

    If you change one of the price in Col.E for particular Part# in Col.B, the price(s) of the same Part# should change to the same.

    Is that correct?

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    If you want above, add bold part to your existing code.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-06-2017
    Location
    Hungary
    MS-Off Ver
    2016
    Posts
    43

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    Yeah that is correct. No, its nothing to do with column C, only the price is the vital part.

  10. #10
    Registered User
    Join Date
    12-06-2017
    Location
    Hungary
    MS-Off Ver
    2016
    Posts
    43

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    Wow thank you this code has it
    But my mistake, the price what is changeing is in the J column, and not in the e (The E is calulating from the J).
    So everything is the same, but the J is the changeing column. I try to replace the code to work that way. (What is a8. before the currentregion?

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    OK
    Change to
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    12-06-2017
    Location
    Hungary
    MS-Off Ver
    2016
    Posts
    43

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    A M A Z I N G !
    Thank you for your help, works like charm!

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Excel VBA: Count Part Numbers which are the same and be able to replace the price all

    That's good.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this 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)

Similar Threads

  1. [SOLVED] Count numbers that are part of text cells with conditions
    By danieloverton1984 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-15-2016, 08:19 AM
  2. Excel Find and Replace part of text in cell with a meaning from another worksheet
    By jiwaniakbar in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-14-2013, 04:21 PM
  3. lookup part description and price from different tabs
    By beerbowerr in forum Excel General
    Replies: 7
    Last Post: 04-13-2012, 05:13 PM
  4. Matching up multiple part numbers with single price
    By sam_m in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2010, 11:55 AM
  5. Referncing a price to get the part
    By JustCofox in forum Excel General
    Replies: 5
    Last Post: 05-20-2007, 08:05 PM
  6. Replies: 1
    Last Post: 12-29-2006, 11:08 AM
  7. Find Part that Has Price, and Retrieve Value
    By christopher.sul in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-03-2005, 02:13 PM

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