+ Reply to Thread
Results 1 to 7 of 7

Troubleshooting: Code works in some instances, but not all....

  1. #1
    Registered User
    Join Date
    04-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Troubleshooting: Code works in some instances, but not all....

    I am importing data files into an Excel spreadsheet and doing some things to certain data after it's imported. In all the files I import, in row 7 of the column right before the column of data I am working with, there is always the word "TRIG." I have code to find the "TRIG" column so that I know where my data is.

    What I'm doing with the data: the info in row 7 of the data column has a lot of headings in it. my first round of code copies this cell to B1 on Sheet2 and separates each headings into its own column. the data in the rest of the column is hexadecimal data. I copy it over to column B on Sheet2, starting in B2, convert the hexadecimal data to binary data, and then split each binary number into its own column. Please ignore the info in column A, with the exception that every column on Sheet2 should have the same number of rows. I am getting this to work for 3 out of 4 files that I am importing, and I can't figure out what the issue is with that 4th file. The headings work fine on the 4th file, but when doing the work on the binary numbers, it skips a few rows, converts to binary, but doesn't split into individual columns.

    Can someone please look at this and help me troubleshoot? My troubleshooting skills are very very novice in VBA right now. The first sample spreadsheet contains a file that works correctly, and the second spreadsheet has the data that isn't working correctly. Just run the macro associated with each to see the end results in each. Thanks in advance!
    Attached Files Attached Files

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

    Re: Troubleshooting: Code works in some instances, but not all....

    Try change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    In your function.

  3. #3
    Registered User
    Join Date
    04-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Troubleshooting: Code works in some instances, but not all....

    jindon,
    That did not work. I saw what you were trying to do with the decimal point though. Any other ideas??

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Troubleshooting: Code works in some instances, but not all....

    The problem is with the way the data is stored in Sheet1 and how your code handles it.

    First there is no spaces in the text in Sheet1!N7 so no column headers on sheet2.

    The first value in N8 is not getting converted to a valid binary string, instead the B2 cell is empty on sheet2. This cell is then used to split text to columns for all items on sheet2 but because it's empty the split does not happen.

    This part results in an empty array
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    04-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Troubleshooting: Code works in some instances, but not all....

    Thanks, Andy. Any ideas on how I might fix the issue? From reading your post, I see what's happening, but I'm not really sure how to tackle it. Thanks!

  6. #6
    Registered User
    Join Date
    04-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Troubleshooting: Code works in some instances, but not all....

    bueller, bueller??

  7. #7
    Registered User
    Join Date
    04-08-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Troubleshooting: Code works in some instances, but not all....

    i have posted this question on other forums since i am in such a deadline crunch. to comply with rule 8, here are the links to my cross-posts:
    http://www.mrexcel.com/forum/showthread.php?t=631715
    http://www.ozgrid.com/forum/showthread.php?t=164821

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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