Results 1 to 4 of 4
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Making a Data file to export (Excel 2003)

    Where in the Input Data sheet can the following data be found?
    - Job Description
    - Length of Perfs
    - Size of Entry Hole
    - Number of Intervals Straddled
    - Number of Shots per Meter

  2. #2
    2 Star Lounger
    Join Date
    Oct 2005
    Location
    Calgary, Alberta
    Posts
    205
    Thanks
    0
    Thanked 1 Time in 1 Post

    Making a Data file to export (Excel 2003)

    Hello,

    I tring to make a macro which has the ability to make a small datafile which will be used to load a program.
    All I am worried about it getting the data into the data file format.

    I have a workbook with 2 worksheets
    -Input Data
    -Data Export File

    Input Data holds all the data that will be necessary for the data file.
    I have attached this workbook.

    1. I am wondering if I have another sheet called Data File Export. (which puts the data into the correct format) would be necessary to format the data file correctly?
    or if a macro could actually make the data file and export the data into a .cfg file without a extra sheet?
    refer to "Data File Export" sheet.

    Below is the format i am trying to acheive:

    [Customer Information]
    Name = "xyz"
    Location = "10-10-010"
    Job Description = "High rate te"

    [Perf Data for Zone 1]
    Bottom Cup Position = 550
    Length of Perfs = 1
    Size of Entry Hole = 0.13
    Number of Intervals Straddled = 1
    Number of Shots Per Meter = 10

    [Perf Data for Zone 2]
    Bottom Cup Position = 525
    Length of Perfs = 1
    Size of Entry Hole = 0.12
    Number of Intervals Straddled = 1
    Number of Shots Per Meter = 10

    [Perf Data for Zone 3]
    Bottom Cup Position = 510
    Length of Perfs = 1
    Size of Entry Hole = 0.13
    Number of Intervals Straddled = 1
    Number of Shots Per Meter = 10

    copied 50 times if needed.

  3. #3
    2 Star Lounger
    Join Date
    Oct 2005
    Location
    Calgary, Alberta
    Posts
    205
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Making a Data file to export (Excel 2003)

    I think my explanation was a little short so here is a more in depth one of what I need help with,

    I have 2 worksheets on call data Input and one called Data File Export.

    Data Input has all the information to make the data file or (.cfg) file.

    data file export page has the data in the format the program that will be opening it needs

    My problem is writing a loop in the macro which can put the data into a format

    starting at A11 Data Input worksheet, the data on row 11 will be moved in to this format:

    ( I am not sure if this should be made on the worksheet DateFile Export and then make a new workbook and paste it in and save the workbook as CompanyName & " " & Location.cfg?)

    [Perf Data for Zone 1] (a11)
    Bottom Cup Position = 487 (C11)
    Length of Perfs = 2 (E11)
    Size of Entry Hole = 0.1 (m11)
    Number of Intervals Straddled = 1 (O11)
    Number of Shots Per Meter = 13 (N11)

    then if a12 is not blank


    [Perf Data for Zone 1] (a11)
    Bottom Cup Position = 485.5 (C12)
    Length of Perfs = 1 (E12)
    Size of Entry Hole = 0.1 (m11)
    Number of Intervals Straddled = 1 (O11)
    Number of Shots Per Meter = 13 (N11)

    and so on as long the value in Column A11 : A60 <> blank
    so the can be a possible of 50 times this can be created.

  4. #4
    2 Star Lounger
    Join Date
    Oct 2005
    Location
    Calgary, Alberta
    Posts
    205
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Making a Data file to export (Excel 2003)

    Option Explicit

    Private Sub ExportNGCDataFile()
    Dim i As Integer
    Dim n As Integer
    Dim Dwsh
    Dim Iwsh
    i = 11
    n = 6
    Set Dwsh = ThisWorkbook.Worksheets("Data File Export")
    Set Iwsh = ThisWorkbook.Worksheets("Data Input")


    Do While Iwsh.Range("a" & i).Value <> ""

    Dwsh.Range("a" & n) = "[Perf Data for Zone " & Iwsh.Range("a" & i).Value & "]"
    n = n + 1
    Dwsh.Range("a" & n) = "Bottom Cup Position = " & Iwsh.Range("C" & i)
    n = n + 1
    Dwsh.Range("a" & n) = "Length of Perfs = " & Iwsh.Range("E" & i)
    n = n + 1
    Dwsh.Range("a" & n) = "Size of Entry Hole = " & Iwsh.Range("M" & i)
    n = n + 1
    Dwsh.Range("a" & n) = "Number of Intervals Straddled = " & Iwsh.Range("O" & i)
    n = n + 1
    Dwsh.Range("a" & n) = "Number of shots per Meter = " & Iwsh.Range("N" & i)

    n = n + 2
    i = i + 1
    Loop
    End Sub



    I think the above will move the data from the input page to the data export file page, but maybe someone could point out a better way i could have done this

Posting Permissions

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