Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Einmaleins

Empfohlene Antworten

Veröffentlicht

Soweit hab ich den Code schon fertig, allerdings soll er nun prüfen, wenn ich die Zahlen eingebe, dass es auch Zahlen sind bzw. mir eine Fehlermeldung ausgeben, wenn sie es nicht sind (also Buchstaben)

Sub Makro1()


Start = Range("B3").Value

Ende = Range("B4").Value


startRow = 7



Rows(startRow & ":65536").Delete



If (Ende - Start) > 255 Then

MsgBox "Leider stehen Ihnen nur 255 Spalten zur Verfügung"

End If


If Range("B3").Value > Range("B4").Value Then

    MsgBox "Der Startwert darf nicht größer als der Endwert sein"

End If






If Start = "" Then

    MsgBox "Bitte etwas eingeben!"

Else


For i = 1 To Ende - Start + 1 Step 1

    ivalue = Start + i - 1

    Cells(startRow + i, 1).Value = ivalue


    For j = 0 To Ende - Start + 1 Step 1

    jvalue = Start + j - 1

    If j = 0 Then

        Value = ivalue

    Else

        Value = jvalue * ivalue

    End If



    Cells(startRow + j, 2 + i - 1).Value = Value

   If jvalue = ivalue Then

    Cells(startRow + j, 2 + i - 1).Font.Bold = True

    End If


Next j

Next i



Range(Cells(startRow, 1), Cells(startRow + Ende - Start + 1, 1)).Select

    Selection.Font.Bold = True

Range(Cells(startRow, 1), Cells(startRow, Ende - Start + 2)).Select

    Selection.Font.Bold = True

Range(Cells(startRow, 1), Cells(startRow + Ende - Start + 1, Ende - Start + 2)).Select

    Selection.Borders(xlDiagonalDown).LineStyle = xlNone

    Selection.Borders(xlDiagonalUp).LineStyle = xlNone

    With Selection.Borders(xlEdgeLeft)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    With Selection.Borders(xlEdgeTop)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    With Selection.Borders(xlEdgeBottom)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    With Selection.Borders(xlEdgeRight)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    Selection.Borders(xlInsideVertical).LineStyle = xlNone

    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone


    With Selection

        .HorizontalAlignment = xlCenter

        .VerticalAlignment = xlBottom

        .WrapText = False

        .Orientation = 0

        .AddIndent = False

        .IndentLevel = 0

        .ShrinkToFit = False

        .ReadingOrder = xlContext

        .MergeCells = False

    End With

Range("A1").Select



Range(Cells(startRow, 1), Cells(startRow + 1, 1)).Select


    Selection.Font.Bold = True

Range("A1").Select

    ActiveWindow.SmallScroll ToRight:=-2


Range(Cells(startRow, 1), Cells(startRow, Ende - Start + 2)).Select

    Selection.Borders(xlDiagonalDown).LineStyle = xlNone

    Selection.Borders(xlDiagonalUp).LineStyle = xlNone

    With Selection.Borders(xlEdgeLeft)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    With Selection.Borders(xlEdgeTop)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    With Selection.Borders(xlEdgeBottom)

        .LineStyle = xlContinuous

        .Weight = xlThin

        .ColorIndex = xlAutomatic

    End With

    With Selection.Borders(xlEdgeRight)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    Selection.Borders(xlInsideVertical).LineStyle = xlNone

Range("A1").Select


Range(Cells(startRow, 1), Cells(startRow + Ende - Start + 1, 1)).Select

    Selection.Borders(xlDiagonalDown).LineStyle = xlNone

    Selection.Borders(xlDiagonalUp).LineStyle = xlNone

    With Selection.Borders(xlEdgeLeft)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    With Selection.Borders(xlEdgeTop)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    With Selection.Borders(xlEdgeBottom)

        .LineStyle = xlContinuous

        .Weight = xlMedium

        .ColorIndex = xlAutomatic

    End With

    With Selection.Borders(xlEdgeRight)

        .LineStyle = xlContinuous

        .Weight = xlThin

        .ColorIndex = xlAutomatic

    End With

Range("A1").Select


End If


End Sub

ich würde eine abfrage mit

if not IsEmpty('Ausdruck') and isNumeric('Ausdruck') then

' Hier kommt nun alles rein, was nicht leer, aber numerisch ist

else if NOT IsEmpty ('Ausdruck') and NOT IsNumeric('Ausdruck') then

'Hier holst dir alle Einträge raus die nicht leer, aber auch nicht numerisch sind

endif

machen

hoffe deine frage ist ausreichend beantwortet

  • Autor

danke für die Antwort, bin kurz danach aber selbst auf die Lösung gekommen. Es hat einfach nur ein:

If Not IsNumeric(Range("B3").Value) Or Not IsNumeric(Range("B4").Value) Then

MsgBox "Bitte geben Sie eine Zahl ein"

End If

gefehlt.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.