+ Reply to Thread
Results 1 to 10 of 10

Auto fill the cell with a value and replace underscores with "dash" and "blanks"

  1. #1
    Registered User
    Join Date
    02-27-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    10

    Auto fill the cell with a value and replace underscores with "dash" and "blanks"

    Hello Forum,
    I have a workbook with 2 dropdown lists in selection tab.
    Is there a way to?
    Populate quantity zero into quantity column when "Yes" is selected in “8 group” column (G4)
    And in G4
    Remove first 3 characters
    Replace underscore between 5 and A with a "dash"
    Replace all remaining underscores with "blanks"

    Please see attached file

    Thank you for your help.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Auto fill the cell with a value and replace underscores with "dash" and "blanks"

    Please clarify

    If you select Yes in G4 then once that's chosen then there is no long group description to change.

    Do you mean that you want the system to remember what's in G4 and THEN if you change G4 to Yes you want the changes you mention made to G4.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-27-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    10

    Re: Auto fill the cell with a value and replace underscores with "dash" and "blanks"

    Hi Richard,
    Yes, you are correct.
    Thank you for your help.
    Kidprojects

  4. #4
    Registered User
    Join Date
    02-27-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    10

    Re: Auto fill the cell with a value and replace underscores with "dash" and "blanks"

    Hi Richard,
    This may clearer what I want for the long description.

    Remove first 3 characters
    Replace underscore between 5 and A with a "dash"
    Replace all remaining underscores with "blank"
    When the Qty > 0 is selected in H column.
    Ex:
    12435-ABC SINGLE MODULE SHELF RLY
    67890-DEF DOUBLE MODULE LCD 4CH
    Thank you

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Auto fill the cell with a value and replace underscores with "dash" and "blanks"

    test reply....Sucuri not permitting full code ????

    Here's the workbook with code
    Last edited by Richard Buttrey; 02-29-2016 at 08:08 PM.

  6. #6
    Registered User
    Join Date
    02-27-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    10

    Re: Auto fill the cell with a value and replace underscores with "dash" and "blanks"

    Hi Richard,
    I download the workbook to test but it's not working.
    Code screen shot.jpg
    Below is the code that I have been working with but I cannot put a "dash" between 5-A and 0-D
    12435-ABC SINGLE MODULE SHELF RLY
    67890-DEF DOUBLE MODULE LCD 4CH

    Please Login or Register  to view this content.
    Could you modify this code to put a "dash" between # and letter?
    Thank you for your help.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Auto fill the cell with a value and replace underscores with "dash" and "blanks"

    Hi,

    I don't understand. The code I gave yuo is putting a dash between the last number after the first three characters have been removed and the first letter.
    I'm not clear why you are trying to modify the code I gave you, but in any case you are not using the relevant bit of the code correctly. i.e. the line

    'sucuri still preventing me adding the line in my original beginning Target = Replace

    Nowhere does your code mention a dash as a replacement and your original data contains both single and double underlines. Unless you build in both those aspects then your code can't work in the way you request.

  8. #8
    Registered User
    Join Date
    02-27-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    10

    Re: Auto fill the cell with a value and replace underscores with "dash" and "blanks"

    Hi Richard,
    The reason I try to modify your code is the original did not work after I download your file and tested. I will try with your original code with the adding Target = Replace.
    Thank you

  9. #9
    Registered User
    Join Date
    02-27-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    10
    Quote Originally Posted by Kidprojects View Post
    Hi Richard,
    The reason I try to modify your code is the original did not work after I download your file and tested. I will try with your original code with the adding Target = Replace.
    Thank you

    Hi Richard,

    How are you?

    I am finally understood how it works.

    1)********* Select the choice from dropdown list in column G

    2)********* Select the QTY from the dropdown list in column H

    3)********* Go back to the dropdown list in column G

    4)********* Select “Yes” to remove first 3 characters, replace underscore between number and letter with a “dash” and replace all remaining underscores with “blanks”

    Your code is brilliance to do all that changes but my goal is little bit different*

    1)********* Select “Yes” in column G, zero is auto populated in column H

    2)********* Select any choice from the dropdown list in column G (other than ”yes”)

    3)********* Select any QTY from the dropdown list in column H to:

    Remove first 3 characters, replace underscore between # and letter with a "dash" and replace all remaining underscores with "blanks" when The QTY is selected in column H

    *

    My modified code is working with above three except it cannot replace underscore between number and letter with a "dash" because I don’t know how to put just a “dash” as a replacement between number and letter in my modified code. Could you please help to fix this code to do that replacement? So sorry for my bad explanation and attached is my new file with the modified code

    Your help is greatly appreciated.

    Cheers

    Kidprojects

    Sucuri is preventing me to upload the new file, hopely you still can fix the modified code that I posted in previous reply.

  10. #10
    Registered User
    Join Date
    02-27-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    10

    Re: Auto fill the cell with a value and replace underscores with "dash" and "blanks"

    Hi Richard,
    Here is my update file.
    Thank you,
    Kidprojects

+ 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. Replies: 3
    Last Post: 06-05-2015, 01:55 PM
  2. [SOLVED] VBA help needed to remove all "/" then replace with "-" from cell "B3"and "B5"
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2014, 02:11 PM
  3. Cell.Replace "XY", Variant(I) & "XY" formulla builder not functioning
    By Leon V (AW) in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-13-2014, 07:11 AM
  4. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  5. [SOLVED] Formula Needed to fill multiple cells with "No" when the word "No" is entered into a cell
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-09-2013, 05:36 PM
  6. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  7. "Blank" and "Non-Blanks in Auto filter menu
    By sivdin in forum Excel General
    Replies: 2
    Last Post: 05-05-2009, 02:37 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