Results 1 to 4 of 4

is it possible to determine parts of a string inside a cell and make an argument?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-03-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    107

    is it possible to determine parts of a string inside a cell and make an argument?

    here is my code, explanation below:

    Select Case cells(1,1).value
        Case "125/240"
            Part_Number = "125"
        Case "100/380"
            Part_Number = "100"
        Case "80/250"
            Part_Number = "080"
        Case "63/125"
            Part_Number = "063"
        ' hundreds of other cases are written below
    end select
    I need a more efficent way of getting the part number. cells(1,1) is a cell where the system inputs a catalogue number for a certain unit. The part number is the number before the "/". I need to extract the part number from cell(1,1). I also need to add the zeroes for example 63/125 would be "065" and 80/250 would be "080"


    So i need an argument that's something like this:

    Get the number before the "/" inside the string and label it as the Part_Number.
    Let X be the number of digits after "/"
    Let Y be the number of digits before "/"
    X-Y = number of Zeroes to add before the part number


    Is VBA capable of doing this? It seems impossible =\...
    Last edited by kjy1989; 10-08-2013 at 03:30 AM.

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: 01-22-2013, 02:09 AM
  2. Split String into 4 Parts - Max 30 Characters per Cell and Whole Words
    By keithm_007 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-22-2012, 05:56 AM
  3. Replies: 7
    Last Post: 07-01-2012, 05:43 PM
  4. Determine the current cell while inside a User Defined Function
    By pmax in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2006, 07:50 PM
  5. [SOLVED] Function (array argument, range argument, string argument) vba
    By Witek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-24-2005, 11:07 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