+ Reply to Thread
Results 1 to 5 of 5

Delimiting when empty column exists.

  1. #1
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Delimiting when empty column exists.

    Hi,

    I have a cell with data separated by hashtags and the letter 'x'

    For example #1001x1 refers to a product code and x1 being the quantity.

    #1002x2#1003x1# would become:

    CODE QTY CODE QTY
    1002 2 1003 1

    I'm currently using the code:

    Please Login or Register  to view this content.
    Sometimes there will be files when there will be lots of codes to delimit, but sometimes there will be no codes to delmit.

    So when there reference will only be #1001x1# the above code will try and delimite the next column along (column G) but there is nothing there to delimit and the error code "No data was selected to parse" pops up.

    What I'm trying to ask is, is there a way to make a macro that only delimit columns with data. Sorry if it's unclear, my knowledge is a little lacking in this subject and it's difficult to explain.
    Last edited by BPSJACK; 07-16-2014 at 04:13 AM.

  2. #2
    Forum Contributor
    Join Date
    06-28-2004
    MS-Off Ver
    Home/Office 2016
    Posts
    246

    Re: Delimiting when empty column exists.

    Can you post an example of it not working...i tried it and it works fine.
    I used these codes - (with some blank cells inbetween)
    #1002x2#1003x1#
    #1002x2#1003

    #1002x2#
    #1002x2
    #1002x2#1003x1

    #1002
    #1002x
    #1002x2#1003x

  3. #3
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Delimiting when empty column exists.

    I have a way around..

    first You have to use split function.. using "#" as dilimiter it will result in an array..

    then transpose this array ...

    after this.. split each cell in that array using the "x" as delimiter..
    and simulteneously populating a second array with values of code and quantity..



    Don't forget to click *

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Delimiting when empty column exists.

    hi BPSJACK, just a thought if I understood everything correctly:

    Option #1

    Manual mode:
    1. Select D column, CTRL+F, find: x, replace: #
    2. Selection, texttocolumns, delimiter: #

    VB:
    Please Login or Register  to view this content.
    Option #2
    In case I'm wrong or you want to stick with what you have for now.

    Add this as the first line of the code:
    Please Login or Register  to view this content.
    This would cancel error message if any wants to appear

  5. #5
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Re: Delimiting when empty column exists.

    Thanks guys, I'll give those solutions a try and report back.

+ 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] Check if cell is not empty and checks if worksheets already exists
    By rskay14 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2014, 02:40 AM
  2. [SOLVED] Pop-up message box if a empty cell exists before copy & paste
    By XxCMoneyxX in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-09-2013, 11:49 AM
  3. If data exists in row.. if not leave empty
    By samfarrugia in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-28-2012, 09:31 AM
  4. remove error value when formula exists for empty cells
    By Cyrus in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-27-2012, 02:49 AM
  5. [SOLVED] Macro delimiting text if column has value
    By Beverly76 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-08-2006, 06:45 PM

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