Sub BereichMultiplizieren()
Dim Bereich As Range
Dim Zelle As Range
Dim Multiplikator As Double
Multiplikator = 2
Set Bereich = Selection
For Each Zelle In Bereich
If IsNumeric(Zelle.Value) Then
Zelle.Formula = Zelle.Value * Multiplikator
End If
Next Zelle
End Sub
Option Explicit
Function PrimzahlenTest(Zahl As Integer) As Boolean
Dim x As Double
Dim y As Double
Dim i As Integer
If Zahl = 1 Then
MsgBox ("Die Zahl 1 ist keine Primzahl!")
Else: For i = 1 To Zahl
x = Zahl / i
If x Mod 2 = 0 Then
y = y + 1
End If
Next
End If
If y > 2 Then
PrimzahlenTest = False
MsgBox ("Die Zahl " & Zahl & " ist keine Primzahl!")
Else
PrimzahlenTest = True
MsgBox ("Die Zahl " & Zahl & " ist eine Primzahl!")
End If
End Function
Function Quersumme(Zahl As String) As Long
Dim i As Long
Dim Rückgabe As Long
For i = 1 To Len(Zahl)
Rückgabe = Rückgabe + (Mid(Zahl, i, 1))
Next
Quersumme = Rückgabe
End Function
Function Rechteck(seiteA As Double, seiteB As Double) As Boolean
Dim Umfang As Double
Dim Fläche As Double
Fläche = seiteA * seiteB
Umfang = (seiteA * 2) + (seiteB * 2)
If Fläche > Umfang Then
Rechteck = True
End If
End Function
Function GrößteZahl(a As Integer, b As Integer, c As Integer) As Double
GrößteZahl = Application.Max(a, b, c)
End Function
Sub Matrix()
Dim zeile As Byte
Dim spalte As Byte
Dim Eingabe As Byte
Eingabe = InputBox("wie groß?")
Do
zeile = zeile + 1
For spalte = 1 To Eingabe
ActiveWorkbook.Worksheets(1).Cells(zeile, spalte) = spalte * zeile
Next spalte
spalte = 1
Loop Until zeile = Eingabe
End Sub
|