+ Reply to Thread
Results 1 to 6 of 6

VBA code to parse raw output report

  1. #1
    Registered User
    Join Date
    08-20-2016
    Location
    Belgrade
    MS-Off Ver
    Windows 7 64-bit, Excel 2007
    Posts
    22

    VBA code to parse raw output report

    Hello.

    I'm using the following code to parse my raw report from row1-Sheet2 and transfer data to Sheet1, creating this kind of table:

    O P Q R
    1
    2 id shop store factory
    3 3456 23 15 25
    4 3467 12 16 28
    5 3468 24 19 33
    6 ... ... ... ...

    Data in row1-Sheet2 are organized in the following pattern: id - shop - stor - fact

    My problem is reflected in the fact that sometimes between the two id's there are no this "shop-stor-fact" cells which means that my prices are often in the wrong row in above table (next to the wrong id).

    I would like to re-arrange this code so in the case that between the two id's there are no this cells which contains significant text (shop-stor-fact), then, in the table, that row stays empty.

    example:

    (id-shop-store-factory) (id-shop-store-factory) (id) (id-shop-store-factory) (id-shop-store-factory) ....


    O P Q R
    1
    2 id shop store factory
    3 3456 23 15 25
    4 3467 12 16 28
    5 3468
    6 3470 24 19 33
    7 3471 27 11 39

    Here is the code I used so far:

    Please Login or Register  to view this content.
    Here is a sample workbook:
    Attached Files Attached Files
    Last edited by smide; 08-29-2016 at 10:42 AM.

  2. #2
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Need help to improve my VBA code

    Show a piece of the original data file. Similar to json.
    To do it for me and help me it is 2 different things!
    Sorry for my english, blame Google translator

  3. #3
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Need help to improve my VBA code

    Try this 1

    Please Login or Register  to view this content.
    Kind regards
    Leo

  4. #4
    Registered User
    Join Date
    08-20-2016
    Location
    Belgrade
    MS-Off Ver
    Windows 7 64-bit, Excel 2007
    Posts
    22

    Re: Need help to improve my VBA code

    Quote Originally Posted by LeoTaxi View Post
    Try this 1

    Please Login or Register  to view this content.
    Kind regards
    Leo
    Thank you for reply and your effort, I really appreciate it.

    I tested your code and indeed for example I posted everything works fine.
    However, when I tested it on some more complex data code it always return id (id list) correct, but I have problem with prices output (missing or even doubled).

    I've noticed that you have changed characters search lines in my second macro...
    Maybe price output problem have something with this issue?
    Please, look at example I've attached in my next post (Code2.xlsx)
    Last edited by smide; 08-29-2016 at 10:53 AM.

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: Need help to improve my VBA code

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  6. #6
    Registered User
    Join Date
    08-20-2016
    Location
    Belgrade
    MS-Off Ver
    Windows 7 64-bit, Excel 2007
    Posts
    22

    Re: Need help to improve my VBA code

    I've attached new complex example (with a bit changed specifications):
    Attached Files Attached Files
    Last edited by smide; 08-29-2016 at 10:51 AM.

+ 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. Does this code needs improvement?
    By amartinez988 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2016, 09:21 AM
  2. [SOLVED] Can I Improve This Code?
    By AHFoddeR in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2013, 12:48 AM
  3. Improve my code: If, or, then
    By Alex532 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-01-2013, 07:19 PM
  4. [SOLVED] To improve Efficiency of code, code running too long
    By andywsw in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-19-2012, 05:54 PM
  5. [SOLVED] Anyone help to improve my code?
    By Andrew in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-05-2006, 10:15 AM
  6. [SOLVED] Re: Improve code
    By rjamison in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2005, 08:05 PM
  7. Improve code
    By Gareth in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-20-2005, 11:06 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