Results 1 to 3 of 3

Thread: Need to use VBA to copy data from a workbook into my workbook based on matching crite

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2018
    Posts
    1

    Need to use VBA to copy data from a workbook into my workbook based on matching crite

    48 x 40 4way .5 GMA.xml35 x 45 2way.xml

    I am hoping one of the guru's here can help me (or even a non-guru ). I know just enough to be dangerous, but not enough to do what i need.

    I am trying to use VBA to extract the thickness, width, and length for each of the 3 components that make up a pallet from an export i get (2 attachments). I want to export the data into a pricing sheet i use, it will save considerable time and errors that occur from typing them in.

    I need VBA to allow me to open a .xml file (i attached 2 example), then insert the component dimensions into my pricing sheet. I tried uploading my pricing sheet, but the site will not allow me to. It is a pretty simple sheet, i put a screen shot below. One issue is sometimes there are 2 width boards on top or bottom, so i need VBA to recognize that and insert either 2 sizes on the top and bottom or just one size. The two files i was able to attach show an example of each.

    I have the code below that allows me to select the file i want to import data from, but i am lost from there...
    I really appreciate any help!! Thank you!!
    Code:
    Option Explicit
    Sub test2()
        Dim wb As Workbook, wb2 As Workbook
        Dim ws As Worksheet
        Dim vFile As Variant
    
        'Set source workbook
        Set wb = ActiveWorkbook
        'Open the target workbook
        vFile = Application.GetOpenFilename("Excel-files,*.xml", _
            1, "Select One File To Open", , False)
        'if the user didn't select a file, exit sub
        If TypeName(vFile) = "Boolean" Then Exit Sub
        Workbooks.Open vFile
        'Set targetworkbook
        Set wb2 = ActiveWorkbook
        
        
     
    End Sub
    Name:  Capture.JPG
Views: 225
Size:  28.1 KB
    Last edited by Shaggy Hiker; Feb 14th, 2018 at 09:33 PM. Reason: Added CODE tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width