1 / 10

Informatika I. 11. Formok, Saját függvények

Informatika I. 11. Formok, Saját függvények. Óra anyaga. Formok Saját függvények. http://krea.bke.hu/VB/makro/. Formok - kiegészítés. Parancsok userForm.Show vbModal userForm.Show vbModeless Unload Me Option Explicit. Saját függvények írása. Function fuggveny(param1, param2)

harlow
Download Presentation

Informatika I. 11. Formok, Saját függvények

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Informatika I. 11. Formok, Saját függvények

  2. Óra anyaga • Formok • Saját függvények http://krea.bke.hu/VB/makro/

  3. Formok - kiegészítés • Parancsok • userForm.ShowvbModal • userForm.ShowvbModeless • UnloadMe • Option Explicit

  4. Saját függvények írása Function fuggveny(param1, param2) fuggveny = param1 & param2 End Function Function negyzetkob(szam) negyzetkob = Array(szam^2, szam^3) End Function Ctrl + Shift + Enter

  5. Példa saját függvényre Function terulet(a As Variant, Optional b As Variant) If IsMissing(b) Then terulet = a * a Else terulet = a * b End If End Function

  6. PI meghatározása • PI = 4 * Math.Atn(1) • Vagy • PI = WorksheetFunction.PI

  7. Feladat • Készíts egy függvényt, amely a sugár megadása után kiszámítja a gömb térfogatát!(V=4r3π/3) • Készítsünk tömbfüggvényt, amely az első elem, a hányados és az elemszám megadása után tömbként visszaadja a mértani sorozat első és utolsó elemét! (an = a1 * qn-1)

  8. Minimumkeresés Minimum = Cells(1,1) For i=2 To 10 If Cells(i, 1) < minimum Then minimum = Cells(i, 1) End If Next

  9. Érték keresése J = 0 Do j = j + 1 Loop Until Cells(j, 1) = keresett Or j = 11 If j < 11 Then MsgBox „Van A(z) ”&Str(j)&”. Elem.” Else MsgBox „Nincs” End If

  10. Sorbarendezés For i = 10 To 2 Step –1 hely = 1 For j = 2 To i If Cells(j, 1) > Cells(hely, 1) Then hely = j End If Next j s = Cells(hely, 1) Cells(hely, 1) = Cells(i, 1) Cells(i, 1) = s Next i

More Related