Results 1 to 5 of 5

Thread: Pascal exercises

  1. #1
    Join Date
    Oct 2008
    Posts
    79

    Pascal exercises

    Hi
    I want to see something that can very easily .. But do not sack .. I have a macro that I print to the screen or write to in column A, the number:

    000000001 to 100000000

    Code:
    Bone: 
    
    A 
    
    000000001 
    000000002 
    000000003 
    000000004 
    
    
    
    099999998 
    099999999 
    100000000
    Greetings!!

  2. #2
    Join Date
    May 2008
    Posts
    2,297
    If you could give me a greater idea of what you need. Or if it is necessary to create a macro. To get started you can select the column to list and put text format, in the row of a column where you want to start list and put the first value eg "00000001" and then select the column. You edit aa / fill / series autorun increase in one, accept and logically if you are ready to fill the last row depends on the version of Excel, if you want to record a macro and whatever changes you do, the variables remain constant.

  3. #3
    Join Date
    Oct 2008
    Posts
    79
    Hi thanks for your answer!! I have a new query.

    I have this code:
    Code:
    Sub numbers () 
    Dim wMax As Long 'number of cells to fill 
    As Long Dim wFil 'current row 
    As Long Dim wCol 'current column 
    As Long Dim WCON "counting of cells filled 
    Dim wTiE As Double 'time (in hours) 
    Dim wTiI As Double 'initial time (in seconds) 
    Dim wTiF As Double 'final time (in seconds) 
    Dim wTiT As Double 'total time (in seconds) 
    As String Dim wCoT 'Contador in text format 
    WMsg As String Dim 'final message of time 
    
    wMax = 100000000 
    WCON = 0 
    wCoT = "" 
    wFil = 1 
    wCol = 1 
    wTiI = Timer 
    For WCON = 1 To wMax 
    wCoT = Format (WCON, "000000000") 
    Range (Cells (wFil, wCol), Cells (wFil, wCol)) = " '" & wCoT 
    Then if wFil = 60000 
    wFil = 1 
    wCol = wCol + 1 
    Else 
    wFil = wFil + 1 
    End If 
    Next 
    wTiF = Timer 
    wTiT = wTiF - wTiI 
    
    wTiE = ((100000000 / 60 / 60) * wTiT) / wMax 
    wMsg = "To" wMax & & "records has been slow" wTiT & & "seconds" & Chr (10) & _ 
    "To take 100000000" wTiE & & "Hours" 
    MsgBox wMsg 
    End Sub
    The problem is that it reaches the column IV and ends there .. and missing numbers. My question is, can I continue to the next path? Example, the path 1 end follows in the path 2.

    Greetings!

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852
    Amending this part of the code, I think it should be run with it. Be sure to take the necessary quantity of leaves in the book candidates = (number of times) / (limit files * limite columns)

    Code:
    Then if wFil = 60000 
    If wCol = 256 Then'256 is the limit of columns in Excel 2003 
    Sheets (ActiveSheet.Index + 1). Activate 
    wCol = 1 
    Else 
    wCol = wCol + 1 
    End If 
    wFil = 1 
    Else 
    wFil = wFil + 1 
    End If

  5. #5
    Join Date
    May 2008
    Posts
    2,297
    If you do not know in advance:
    a) the number of rows
    b) the number of columns
    c) the quantity of leaves

    Follow these steps:
    Code:
    which is supposed to start the sheet is blank, no details. 
    'Here I tell VBA that from cell A1, go to the end (end), down' (xlDown) and I return the nro row. I do the same thing towards the end and to the right 
    'to determine the number of existing columns: 
    TotalFilas = Cells (1,1). End (xlDown). Row 
    TotalColumnas = Cells (1,1). End (xlRigth). Column 
    'or a much easier: 
    TotalFilas = ActiveSheet.Rows.Count 
    TotalColumnas = ActiveSheet.Columns.Count 
    'to the total leaf from the book: 
    TotalHojas = ActiveWorkbook.Sheets.Count
    next you're driving the leaves and if necessary, add sheets

Similar Threads

  1. How to write program to generate a pascal triangle in java?
    By Aandaleeb in forum Software Development
    Replies: 7
    Last Post: 11-09-2011, 12:37 PM
  2. C# exercises
    By puk284 in forum Software Development
    Replies: 2
    Last Post: 03-02-2009, 08:12 AM
  3. Pascal language for beginners
    By Abaan in forum Software Development
    Replies: 3
    Last Post: 07-01-2009, 01:21 PM

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
  •  
Page generated in 1,713,907,940.99455 seconds with 17 queries