Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

I need to generate one prn file for the output

Posted on 2013-12-19
2
Medium Priority
?
403 Views
Last Modified: 2013-12-23
Dear All,

I am generating in my attached excel sheet more than the Excel limit data and I need to split that to different sheets, if it exceed the limit. Could you help me in that?

Or I need to generate one prn file for the output

The Excel Macro is attached.

Regards,

Dallag
GRIDPETREL.xlsm
0
Comment
Question by:Mohammed Dallag
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points
ID: 39729798
Try this macro. Make sure you change the filename/pathname to your own.

Public Sub FillGrid()
    Dim lngv As Single
    Dim intx As Integer
    Dim inty As Integer
    Dim intval, intvaly, intvalx As Long
    intval = 0
    Dim minGridx, minGridy, maxGridx, maxGridy, GridSizeX, GridSizeY, XStep, Ystep, sngval, PetrelNull As Single
    Dim strval As String
    Open "C:\Users\SSaqib\Documents\Gridpetrel.prn" For Output As #1
    'Worksheets("PETRELGRID").Range("A1:IV40001").Clear
    minGridx = Sheets("PARAM").Cells(2, 1)
    minGridy = Sheets("PARAM").Cells(2, 2)
    maxGridx = Sheets("PARAM").Cells(2, 3)
    maxGridy = Sheets("PARAM").Cells(2, 4)
    GridSizeX = Sheets("PARAM").Cells(2, 5)
    GridSizeY = Sheets("PARAM").Cells(2, 6)
    XStep = (maxGridx - minGridx) / GridSizeX
    Ystep = (maxGridy - minGridy) / GridSizeY
    PetrelNull = Sheets("PARAM").Cells(2, 7)
    intvalx = 0
    For inty = 1 To Sheets("PARAM").Cells(2, 6) 'F2
        intvalx = intvalx + 1
        intvaly = 0
        For intx = 1 To Sheets("PARAM").Cells(2, 5) 'E2
            intval = intval + 1
            'Sheets("PETRELGRID").Cells(intval, 1) = minGridx + (intx - 1) * XStep
            'Sheets("PETRELGRID").Cells(intval, 2) = minGridy + (inty - 1) * Ystep
            sngval = Sheets("OFMGRID").Cells(GridSizeX - intvalx + 1, 1 + intvaly)
            If sngval = 0 Then
                strval = Trim$(Sheets("OFMGRID").Cells(GridSizeX - intvalx + 1, 1 + intvaly))
                If Len(strval) = 0 Then sngval = PetrelNull
            End If
            'Sheets("PETRELGRID").Cells(intval, 3) = sngval
            Print #1, minGridx + (intx - 1) * XStep, minGridy + (inty - 1) * Ystep, sngval
            intvaly = intvaly + 1
        Next intx
    Next inty
End Sub
0
 

Author Closing Comment

by:Mohammed Dallag
ID: 39735772
Excellent Answer
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
New style of hardware planning for Microsoft Exchange server.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question