SHARE
TWEET

Untitled

a guest Apr 14th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim liczba_2 As Double
  2.  
  3. liczba = 5
  4. liczba_2 = 2.5
  5.  
  6. Worksheets("Arkusz1").Cells(1, 2) = liczba
  7. Worksheets("Arkusz1").Cells(1, 3) = liczba_2
  8. Worksheets("Arkusz1").Cells(2, 1) = liczba + liczba_2
  9.  
  10. Dim suma As Double
  11. suma = Worksheets("Arkusz1").Cells(2, 1)
  12. If suma > 6 Then
  13.     Worksheets("Arkusz1").Cells(3, 1) = "liczba jest większa od 6"
  14. ElseIf suma < 6 Then
  15.     Worksheets("Arkusz1").Cells(3, 1) = "liczba jest mniejsza od 6"
  16. Else
  17.     Worksheets("Arkusz1").Cells(3, 1) = "liczba równa 6"
  18.  
  19. End If
  20.  
  21. For i = 1 To 10 Step 1
  22. Worksheets("Arkusz1").Cells(i, 1) = i
  23. Next i
  24.    
  25. -----------------------
  26. Dim liczba As Long
  27.  
  28. liczba = Worksheets("Arkusz1").Cells(1, 1)
  29. silnia = 1
  30.  
  31. For i = 1 To liczba Step 1
  32. silnia = i * silnia
  33. Next i
  34.  
  35. Worksheets("Arkusz1").Cells(2, 2) = silnia
  36.  
  37. _______________________
  38. Dim tekst_A, tekst_B As String
  39. Dim liczba_A As Double
  40. Dim liczba_B As Double
  41.  
  42. tekst_A = InputBox("Podaj liczbe A")
  43. tekst_B = InputBox("Podaj liczbe B")
  44. If IsNumeric(tekst_A) = True And IsNumeric(tekst_B) = True Then
  45.     liczba_A = CDbl(tekst_A)
  46.     liczba_B = CDbl(tekst_B)
  47.     suma = liczba_A + liczba_B
  48.     Worksheets("Arkusz1").Cells(1, 1) = suma
  49.     Else
  50.     MsgBox ("Tekst nie jest liczba")
  51. End If
  52.  
  53. _______________________
  54. Sub licz_pole()
  55.     Dim tekst_a As String
  56.     Dim tekst_b As String
  57.     Dim bok_a As Double
  58.     Dim bok_b As Double
  59.     Dim prostokat As Double
  60.     Dim figura
  61.    
  62.     figura = InputBox("co chcesz policzyć t- trojkat, p-prostokat")
  63.     tekst_a = InputBox("Podaj bok a")
  64.     tekst_b = InputBox("Podaj wysokość b")
  65.    
  66.     If (IsNumeric(tekst_a) = True And IsNumeric(tekst_b) = True) Then
  67.         bok_a = CDbl(tekst_a)
  68.         bok_b = CDbl(tekst_b)
  69.        
  70.         If (figura = "p") Then
  71.             prostokat = pole_prostokat(bok_a, bok_b)
  72.             MsgBox ("Pole prostokata= " + CStr(prostokat))
  73.         ElseIf (figura = "t") Then
  74.             Trojkat = pole_trojkat(bok_a, bok_b)
  75.             MsgBox ("Pole trójkąt = " + CStr(Trojkat))
  76.          Else
  77.             MsgBox ("Bład")
  78.         End If
  79.        
  80.     Else
  81.         MsgBox ("Podane litery zamiast liczb")
  82.     End If
  83.    
  84.    
  85.    
  86. End Sub
  87.    
  88. Function pole_prostokat(a As Double, b As Double) As Double
  89.     pole_prostokat = a * b
  90. End Function
  91.  
  92. Function pole_trojkat(a As Double, b As Double) As Double
  93.     pole_trojkat = (a * b) / 2
  94. End Function
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top