+ Reply to Thread
Results 1 to 3 of 3

Excel VBA import skipping columns

  1. #1
    Registered User
    Join Date
    09-18-2021
    Location
    Boston
    MS-Off Ver
    10
    Posts
    1

    Excel VBA import skipping columns

    Hi, I am new to the group and new to coding in vba

    I am trying to import 100+ .dat files with tilde delimiter having few empty columns. My query works fine if the cell has value. However if the cell is empty it ignores the cells, which changes the file layout.

    If the column is empty then the cell should be blank instead of skipping the cell.

    Here is my code:

    Please Login or Register  to view this content.
    Here is the sample data:

    Column 7 and Column 11 are empty and I would like to import the column with null value

    1012955820101~12121212121~ABCED GHIJKL MNOPQ RSTUVW XYZ~20201117~20210125~3.200~~3.200~2630.75~3303.80~~000003649462~/~1588765986~01~001~0000000000000~?~N~05340516880~0~0.00~0.00~?~0.00~28~1417205527~?~505~1~01
    1050950936101~12121212121~ABCED GHIJKL MNOPQ RSTUVW XYZ~20201118~20210301~3.200~~3.200~2630.75~3303.80~~000003651745~/~1588765986~01~001~0000000000000~?~N~05358851520~0~0.00~0.00~?~0.00~28~1417205527~?~505~1~01
    0363951048001~12121212121~ABCED GHIJKL MNOPQ RSTUVW XYZ~20201120~20210111~3.200~~3.200~2630.75~3303.80~~000003651998~/~1588765986~01~001~0000000000000~?~N~05355951440~0~0.00~0.00~?~0.00~28~1417148073~?~505~1~01
    1008953335201~12121212121~ABCED GHIJKL MNOPQ RSTUVW XYZ~20201209~20210119~3.200~~3.200~2630.75~3441.03~~000003786038~/~1417969882~02~001~0000000000000~?~N~05356967340~0~0.00~0.00~?~0.00~21~1467074328~?~150~1~05
    1034951077901~12121212121~ABCED GHIJKL MNOPQ RSTUVW XYZ~20201210~20210216~3.200~~3.200~2630.75~3962.53~~000000961982~/~1831299874~03~001~0000000000000~?~N~05359621170~0~0.00~0.00~?~0.00~28~1366579138~?~304~1~01

    Thank you!
    Last edited by alansidman; 09-19-2021 at 12:58 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Excel VBA import skipping columns

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

    Additionally, Please read the yellow banner at the top of this page.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Excel VBA import skipping columns


    Quote Originally Posted by VPSM View Post
    If the column is empty then the cell should be blank instead of skipping the cell.
    Hi, 'cause the import is just not well set !
    As your code has the bad idea to set the parameter 'ConsecutiveDelimiter' to True …

+ 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. Import text into multiple columns Excel
    By sacblanc in forum Excel General
    Replies: 5
    Last Post: 02-09-2020, 11:25 PM
  2. import text columns into excel
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 41
    Last Post: 06-15-2019, 10:03 AM
  3. Macro to import certain columns from a different excel file
    By adamgm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2018, 08:38 PM
  4. copy values from columns to rows while skipping empty columns...
    By EricCy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-10-2016, 06:20 AM
  5. import excel columns with pictures
    By bsapaka in forum Access Tables & Databases
    Replies: 2
    Last Post: 06-19-2014, 10:53 PM
  6. How to import specific columns from excel file
    By Drehb4life in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-26-2013, 12:55 PM
  7. [SOLVED] Can I import data into columns in Excel ?
    By Nickie in forum Excel General
    Replies: 1
    Last Post: 07-19-2006, 05:10 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