Sub aruanne1() Dim tLeht As Worksheet reanr = 1 While (Len(Sheets("Matemaatika").Cells(reanr, 1)) > 0) reanr = reanr + 1 Wend 'MsgBox (reanr - 1) & " nime" Set tLeht = Sheets.Add 'loon uue lehe tLeht.Cells(1, 1) = "Algsel lehel oli " & _ (reanr - 1) & " nime" End Sub Sub jukuHinded() Dim ained(3) As String ained(1) = "Matemaatika" ained(2) = "Laulmine" ained(3) = "Keemia" Set tLeht = Sheets.Add For opilasenr = 1 To 3 tLeht.Cells(1, opilasenr + 1) = _ Sheets(ained(1)).Cells(opilasenr, 1) Next opilasenr For ainenr = 1 To 3 tLeht.Cells(ainenr + 1, 1) = ained(ainenr) For opilasenr = 1 To 3 tLeht.Cells(ainenr + 1, opilasenr + 1) = _ Sheets(ained(ainenr)).Cells(opilasenr, 2) Next opilasenr Next ainenr End Sub Sub opilasteHinded() Dim ained(3) As String ained(1) = "Matemaatika" ained(2) = "Laulmine" ained(3) = "Keemia" For opilasenr = 1 To 3 Set tLeht = Sheets.Add tLeht.Name = _ Sheets(ained(1)).Cells(opilasenr, 1) For ainenr = 1 To 3 tLeht.Cells(ainenr, 1) = ained(ainenr) tLeht.Cells(ainenr, 2) = _ Sheets(ained(ainenr)).Cells(opilasenr, 2) Next ainenr Next opilasenr End Sub Sub opilasteHindeLoetelu() Dim ained(3) As String ained(1) = "Matemaatika" ained(2) = "Laulmine" ained(3) = "Keemia" For opilasenr = 1 To 3 Set tLeht = Sheets.Add tLeht.Name = _ Sheets(ained(1)).Cells(opilasenr, 1) For ainenr = 1 To 3 tLeht.Cells(ainenr, 1) = ained(ainenr) hindeveerg = 2 While Len(Sheets(ained(ainenr)). _ Cells(opilasenr, hindeveerg)) > 0 tLeht.Cells(ainenr, hindeveerg) = _ Sheets(ained(ainenr)). _ Cells(opilasenr, hindeveerg) hindeveerg = hindeveerg + 1 Wend Next ainenr Next opilasenr End Sub Sub failid1() Open "c:\temp\katsetus.txt" For Output As #1 Print #1, "Tere" Print #1, "Tulemast" Close #1 End Sub Sub failid2() Open "c:\temp\katsetus.txt" For Output As #1 For i = 1 To 20 Print #1, i * i Next i Close #1 End Sub Sub failid3() Open "c:\temp\katsetus.txt" For Output As #1 reanr = 1 While Len(Sheets("Matemaatika").Cells(reanr, 1)) > 0 Print #1, Sheets("Matemaatika").Cells(reanr, 1) reanr = reanr + 1 Wend Close #1 End Sub Sub failid4() Open "c:\temp\katsetus.html" For Output As #1 Print #1, "" Print #1, " Nimed" Print #1, " " Print #1, " " Print #1, " " Print #1, "" Close #1 End Sub