+ Reply to Thread
Results 1 to 10 of 10

Defining Segments of Text From General Workbook

  1. #1
    Registered User
    Join Date
    08-23-2013
    Location
    Albany
    MS-Off Ver
    Excel 2010
    Posts
    34

    Exclamation Defining Segments of Text From General Workbook

    Hey everyone,

    So I am very new to macro's but I am trying to accomplish a relative simply task (in my mind) on my workbook. What I have is a drawing number for example B123A45B12B012, each segment of this number has a variable defined by my worksheet. So for another example I will break up that number into what I am pulling; B123-A-45-B-12-B-012. Again each segment of this already is defined in my workbook with dozens of different values depending on that number, I would like to be able to type my part number in and either A. have it highlight all my fields of data that apply, or B. re display all my needed data in a new table easy to read, to avoid having to search through this long document for my needed info. Any help is very much appreciated and thanks in advance for those who contribute.
    Last edited by smiz; 08-23-2013 at 10:21 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Defining Segments of Text From General Workbook

    Hi smiz and welcome to the forum,

    Excel has an "Advanced Filter" option that is made for this kind of problem, but it is a little tricky.

    Find the attached which was an old problem I worked on that has lots of data. I'm using this table as an example.
    You want to filter your data based on parts of the Part string. IE you want to only see parts with the third character of an "A". Read first of all
    http://office.microsoft.com/en-001/e...Mcasesensitive the section that has the wildcard characters.

    To find the third character of an A you would need to put ="=??A*" as the criteria in an Advanced Criteria.

    See my attached where I've filtered all Part Numbers with a "36" as the second and third characters in the Part Number string.

    I hope this gets you started learning how to do wildcard character filters using Advanced Filters...
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    08-23-2013
    Location
    Albany
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Defining Segments of Text From General Workbook

    I read through this briefly and figured it would be beneficial to provide an example sheet. Due to the nature there is a lot of missing data but so you get the idea of what my mission is. I'm not actually looking for just a name or group of data within a large sheet, I would actually like my macro to read my segment or character number: "45" and know that it needs to search "x" column and have "x" value to create a hit. My ultimate goal would be to type my full number B123A45B12B012 and have the program read each defined segment and create a new sheet, instead of me having to search through everything.

    test.xls

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Defining Segments of Text From General Workbook

    Hi,

    I don't see how your example fits your question.

  5. #5
    Registered User
    Join Date
    08-23-2013
    Location
    Albany
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Defining Segments of Text From General Workbook

    I'll give my best go at explaining this lol. So here is my part number segmented B123-A-45-B-12-B-012, at the bottom of the linked table it shows what each segment is correlated to. So for this example lets use the second segment "A". The chart at the bottom means A is "I", so on that chart I would go to "I" and look at "A" and it would give me the following three dimensions to the right. Then the next segment is "45", so "45" equals "II". In this case my made up "45" is not an actual example on this table but you would then read the "II" column and go to "45". Which would would then need "III" and "IV" to figure out your dimensions. So you would need your "B", "12", and "B" to get your dimensions to the right of it. Again this is a made up number so it doesn't match the table but hopefully will give you a clearer picture of what I'm trying to accomplish. Also all the empty boxes are actual dimensions. Hopefully this can better explain my case if not feel free to ask more questions. Thanks for the help!!

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Defining Segments of Text From General Workbook

    Hi smiz,

    I'm still clueless on how this puzzle fits together. Maybe a sample file with some notes on it might help. How about using a real example and show exactly what you want back from the vba code.

  7. #7
    Registered User
    Join Date
    08-23-2013
    Location
    Albany
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Defining Segments of Text From General Workbook

    Hi,

    So unfortunately I can't provide the actual example but here is a new number: B123A48E12B012, Segmented -B123-A-48-E-12-B-012. So again this part number is broken up to several segments, each segments brings you to a column in that spread sheet (I,II,III,IV,V,VI). with this new example I will break down each segment and have it shown with all false numbers loaded into the spread sheet. "B123" would define my worksheet that i'll be using (something you would visually see, doesn't need code). So then i look at my next segment "A" this will define my column "I", but you also need to know column IV to be able to get diameter 6,7,8. So i would then skip segments to find the value in my part code that goes with column IV which you will figure out from the small table at the bottom. In this case Column IV is defined by the part of the segment that is "12". so you would then go down column "IV" to "12" and follow then column "I" along the "A" row (both shown in yellow). And this will give you your diameter for 6,7,8 highlighted in green. Now we have to find Dia. 1-5 so we need to find column II and III. In this case after following the small table at the bottom we can see that II is the segment containing "48" and III is Segment containing "E" (shown in yellow). Now with these two you can find Dia. 1-5 (shown in green). And now your part dimensions are fully defined. So now we have matched your segments B123,1,48,E,12 and segments B and 012 I have left out of the table but would usually be another defining dimension. So what I want is a code that would say in this case: the first character through the 4th character will define your spread sheet, 5 character will define "I", 6th and 7th character will define "II", 8th character will define "III", 9th and 10th character will define "IV", 11th character will define "V", and 12th,13th and 14th character will define "VI". I would like to have this code run the example we just did instead of me having to manually go back and forth and follow the rows to define the dimensions of my part. I don't now anything about code really but for the first section we did to define Diameters 6-8 it would go something like this(again I don't know code); if character 9 and 10 equals column IV check that character 5 equals column I and then have it display those dimensions we highlighted in green. Hopefully this help, again I don't know a lot about this and I can't show the actual table so this makes it hard for me to explain. again thanks for the help and attached is new sheet.

    test.xls

  8. #8
    Registered User
    Join Date
    08-23-2013
    Location
    Albany
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Defining Segments of Text From General Workbook

    Anyone else able to understand my gibberish?

  9. #9
    Registered User
    Join Date
    08-23-2013
    Location
    Albany
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Defining Segments of Text From General Workbook

    monday morning bump

  10. #10
    Registered User
    Join Date
    08-23-2013
    Location
    Albany
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Defining Segments of Text From General Workbook

    Anyone got anything?

+ 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. Requesting help in Excel Macro Tutorial/Basic Steps in creating a Macro in Excel
    By rhaiyan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2013, 09:21 PM
  2. Replies: 2
    Last Post: 11-26-2012, 08:33 AM
  3. Excel Macro (excel for mac 2010) - update multiple excel books on criteria
    By genichigo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-15-2012, 07:23 AM
  4. Excel 2003 Macro --> Excel 2000 Macro
    By Tejas.T in forum Excel General
    Replies: 2
    Last Post: 10-21-2012, 07:57 AM
  5. Macro using file dialog opener - Cannot delete or rename folder when excel macro is
    By startrekremo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2011, 01:57 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