+ Reply to Thread
Results 1 to 21 of 21

Split string in array not in cell range vba excel macro

  1. #1
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Split string in array not in cell range vba excel macro

    Hello , I am just new in creating macro and I have a macro that my colleague created which we used in our work . But she is not working with us now and I need to do some changes.

    Is it possible to get part of string in a string from other range to other cells? IS there's any code available for this? I think I need to split the data I need from column G to have the right result for column H and I. If there's any good help thank you in Advance.
    example:


    column G column H column I

    LB230X200X45/20 20(string get from G) 200(string get from G)
    LB5000X2000X40/25 25(string get from G) 2000(string get from G)

    FB01O.jpg
    3a3JG.jpg
    Last edited by Yajson; 12-30-2017 at 12:58 AM.

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

    Re: Split string in array not in cell range vba excel macro

    Please Login or Register  to view this content.
    If this doesn't work, upload a workbook.
    Picture doesn't help at all.

  3. #3
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Re: Split string in array not in cell range vba excel macro

    Hi Jindon your code is working . But I still have some concern. If you will see I have two existing rows with data.
    The procedure will be like:

    1. duplicate the two original data from the two rows. therefore it will have 4 rows , 2 or the first row and 2 for the second row.
    2. after duplicate I want to change only the Thickness and width of the newly added rows which the data is from ProfileType Column.

    it means my sheet will provide 4 different thickness and width data . the two original data as untouched and two added width and thickness data for newly added.

    below is my added snapshot and code:
    Untitled.jpg

    Please Login or Register  to view this content.
    Last edited by AliGW; 12-30-2017 at 06:23 AM. Reason: Unnecessary quotation removed.

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

    Re: Split string in array not in cell range vba excel macro

    1)
    Don't quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding

    For normal conversational replies, try using the QUICK REPLY box below.

    2) Upload a workbook with before/after clearly showing the logic. Picture will not help.
    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.

  5. #5
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Re: Split string in array not in cell range vba excel macro

    Sorry I am just new .. I am trying to attached file but I don't know I cannot attach...

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

    Re: Split string in array not in cell range vba excel macro

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  7. #7
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Post Re: Split string in array not in cell range vba excel macro

    Hi Jindon, Kindly see my code.. thank you
    Attached Files Attached Files

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

    Re: Split string in array not in cell range vba excel macro

    Can you just upload 2 worksheets showing before macro and after macro? I mean your desired result?
    Last edited by jindon; 12-30-2017 at 06:52 AM.

  9. #9
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Re: Split string in array not in cell range vba excel macro

    Hi Jindon , I already provide in the snapshot attached in my first post.. I upload two snapshot , preliminary format and the result after code execution. Kindly see above...

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: Split string in array not in cell range vba excel macro

    Did you not read post #4 about pictures?

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

    Re: Split string in array not in cell range vba excel macro

    Quote Originally Posted by jindon View Post
    If this doesn't work, upload a workbook.
    Picture doesn't help at all.
    Quote Originally Posted by jindon View Post

    2) Upload a workbook with before/after clearly showing the logic. Picture will not help.
    Quote Originally Posted by jindon View Post
    Can you just upload 2 worksheets showing before macro and after macro? I mean your desired result?
    No matter how many pictures you post, it will be of no help.

    Hope someone else to help you.

  12. #12
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14
    I will reupload again .sorry..
    Last edited by Yajson; 12-30-2017 at 10:31 PM.

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Split string in array not in cell range vba excel macro

    It's a little sloppy but seems to be a start:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  14. #14
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Re: Split string in array not in cell range vba excel macro

    Hi Jindon I already manage to make it work . Kindly see the attached file and check.
    Instead of assigning "G" in "For i = 3 To Range("G" & Rows.Count).End(xlUp).Row Step 2" , I assigned "F" to have the desire result.

    I have one more question .. Can you explain to me what's the meaning of below code? It quite unfamiliar for me as new for doing this stuff. Thank you

    .Pattern = "X(\d+(\.\d+)?)X.*?/(\d+(\.\d+)?)$"
    Attached Files Attached Files
    Last edited by Yajson; 12-30-2017 at 11:01 PM.

  15. #15
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Re: Split string in array not in cell range vba excel macro

    Quote Originally Posted by xladept View Post
    It's a little sloppy but seems to be a start:

    Please Login or Register  to view this content.
    Hi XLAdept.. I will try this one...

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

    Re: Split string in array not in cell range vba excel macro

    If you want it like that
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Re: Split string in array not in cell range vba excel macro

    Hi XLAdept. your code is working. The only thing is that it highlight the rows. But it is working well...

  18. #18
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Re: Split string in array not in cell range vba excel macro

    Hi Jindon, our code is working well also .. I've learned a lot about all of your codes . But can you explain to me what's the meaning if this code so that next time I will be able to create my own syntax.

    .Pattern = "X(\d+(\.\d+)?)X.*?/(\d+(\.\d+)?)$"

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

    Re: Split string in array not in cell range vba excel macro

    Goole first with the key words like

    VBA Regular Expression meta character

  20. #20
    Registered User
    Join Date
    06-12-2017
    Location
    SINGAPORE
    MS-Off Ver
    WINDOWS 7
    Posts
    14

    Re: Split string in array not in cell range vba excel macro

    ok I will do. thanks this thread is closed..

  21. #21
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Split string in array not in cell range vba excel macro

    Thanks for the rep!

+ 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] VBA code required to TRIM and SPLIT the selected Range (String)
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2015, 04:04 AM
  2. Find value in a value range in a split string
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-28-2013, 07:47 AM
  3. [SOLVED] Return matching string in array if cell contains string contained in the array
    By AaronsZ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-03-2013, 01:55 PM
  4. macro to find text string in cell range and paste in other cell range
    By slearner1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2013, 11:15 AM
  5. Excel Split Single Cell Array into Multiple Cells
    By devinpitcher in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 12-07-2012, 07:13 AM
  6. Split string by line break into array
    By kennychung in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2009, 12:18 PM
  7. how to split a string and return array
    By xiang in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2005, 07:55 AM

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