+ Reply to Thread
Results 1 to 9 of 9

VBA script to extract simple data from test list to create report.

  1. #1
    Registered User
    Join Date
    06-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    VBA script to extract simple data from test list to create report.

    Hi guys,

    This is slightly urgent and i was given it Friday to complete for the weekend - ..


    I need a VBA based process where i copy a list of semi formatted text into workbook1 [manual process]. The text is organised as a simple series of line data. i.e. a screen copy and paste from data service

    I then want to be able to assign the process to a button to run the scan / extract / convert / add to archive

    i.e.
    RAW data:
    PORT**************** IFO - 380 CST IFO - 180 CST MDO MGO
    Fujairah************ 591.50-592.50 603.50-604.50 984.00-985.00 989.00-990.00

    There are numerous 'Ports' in the text list but i only need to extract about 12 plus their price data


    Based on a small table in worksheet2 [PortName, ProductID, price1, price2 price3] defining what price elements i want from the Port - i want to cycle through [ ColumnA 1-200] workbook1 searching for the content in the table in worksheet2. Always the "PortName" is the first part of the line string so search using left() function

    It will cycle through the worksheet1 line data for each Portname entry in the table found in worksheet2

    Once it locates the line [identified by the "PortName", we then need to check what data [as identified by a "1" [a flag it is selected] next to the Portname in worksheet2] and extract and convert it from text to price, and store in worksheet3 [Report]

    In effect, we are trying to extract only Port data for the key ports used - and the product [IFO-380 or IFO-180]

    Price History:

    Finally - for a given result - we want to store the daily data in it's own worksheet - so we have a daily price history worksheet for each port + product [each port has it's own worksheet with Date, MIN-MAX data for each product [380, 180, MGO]

    Given enough time I can do this but it will take me most of the weekend to re-educate myself in VBA so appreciate anyone who can help me work through this.

    I can email the xls to work with but copyright means i cannot publish here.

    help! :-)

    Thx

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: VBA script to extract simple data from test list to create report.

    Ok No. 1, I hope you were not hired b/c they thought you were VBA proficient?
    No.2 Post a sample workbook to get an idea of what you need.
    No.3 I hope your boss knows you are out sourcing?
    No.4 I am just kidding. But not about the sample workbook.
    Last edited by JapanDave; 06-23-2012 at 05:21 AM.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Registered User
    Join Date
    06-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: VBA script to extract simple data from test list to create report.

    Thx JapanDave

    It is actually a friend of mine... very persuasive... always urgent...

    I can only really email sample xls.. else data source company can / often do get upset

    I moved to Pascal then Object C some time ago - my VB / VBA is very dusty but if need be.. just from a logic perspective I know it's not a big task... but it will take me time to relearn - especially under Excel

    Once the core is demonstrated i can tweak when [and it will continue for weeks...] my friend looks to expand it.

    Thx again..

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: VBA script to extract simple data from test list to create report.

    Go to advanced reply and upload a sample workbook to the forum. Make sure no personal data is included. Cheers

    BTW, I was just joking in the above post.

  5. #5
    Registered User
    Join Date
    06-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: VBA script to extract simple data from test list to create report.

    Hi JapanDave - I got some [predictable] changes in so just trying to find a pattern in the text / positioning / spaces where absent value should be.

    Will post once i have sorted this so i don't waste anyones time.

    Hope tonight [CET] else tomorrow.

    Br

  6. #6
    Registered User
    Join Date
    06-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: VBA script to extract simple data from test list to create report.

    See how this looks and if it makes sense.

    Many thanks for taking the time.

    Br
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: VBA script to extract simple data from test list to create report.

    ping.... :-)

  8. #8
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: VBA script to extract simple data from test list to create report.

    Ok, I looked at the sheet. But I don't understand how you are getting max and min values? Everything else seems easy enough to follow.

  9. #9
    Registered User
    Join Date
    06-16-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: VBA script to extract simple data from test list to create report.

    Thx again:

    It would look like this:

    PORT**************** IFO - 380 CST IFO - 180 CST***** MDO********** MGO
    Fujairah************ 591.50-592.50 603.50-604.50 984.00-985.00 989.00-990.00

    PORT IFO - 380 IFO - 180 CST MDO MGO
    Fujairah 591.50-592.50 603.50-604.50 984.00-985.00 989.00-990.00

    MIN MAX MIN MAX MIN MAX MIN MAX
    Fujairah 591.5 592.5 603.5 604.5 984 985 989 990

    Let me know if this makes sense.
    BR

+ 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