06.04.2021, 12:43
(Dieser Beitrag wurde zuletzt bearbeitet: 06.04.2021, 19:58 von WillWissen.
Bearbeitungsgrund: Codetags
)
Hallo Leute,
habe hier mal nen Code von VB für euch den ich in eine einfache Befehlsschaltfläche integrieren möchte. Allerdings ploppt dann im Compiler kurzerhand folgender Fehlercode auf: "Laufzeitfehler '5': Ungültiger Prozeduraufruf oder ungültiges Argument"
so sieht das ganze aus. Fällt euch vielleicht etwas auf?
Danke vorab!
Liebe Grüße
habe hier mal nen Code von VB für euch den ich in eine einfache Befehlsschaltfläche integrieren möchte. Allerdings ploppt dann im Compiler kurzerhand folgender Fehlercode auf: "Laufzeitfehler '5': Ungültiger Prozeduraufruf oder ungültiges Argument"
Code:
Private Sub CommandButton1_Click()
Range("D10:F12").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.Name = "Webdings"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Range("C8:C14").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark2
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
Range("D8:G9").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark2
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
Range("D13:G14").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark2
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
Range("G10:G12").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark2
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
Range("D6:F7").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("D10:F12").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 420, 107.25, 180, _
148.5).Select
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 29).Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0
.Solid
End With
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
Selection.ShapeRange.TextFrame2.VerticalAnchor = msoAnchorMiddle
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = _
"Mit F9 Würfelzauber beginnen!"
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 29). _
ParagraphFormat
.FirstLineIndent = 0
.Alignment = msoAlignCenter
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 6).Font
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 11
.Name = "Arial Black"
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(7, 23).Font
.BaselineOffset = 0
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 11
.Name = "Arial Black"
End With
Range("D6:F7").Select
ActiveCell.FormulaR1C1 = "=TRUNC(RAND()*9)+1"
Range("D6:F7").Select
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With
Selection.Font.Bold = True
With Selection.Font
.Name = "Arial"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16776961
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Selection.Font.Size = 12
Selection.Font.Size = 14
Selection.Font.Size = 16
Selection.Font.Size = 18
Selection.Font.Size = 20
Selection.Font.Size = 22
Selection.Font.Size = 24
Selection.Font.Size = 26
Range("D10").Select
ActiveCell.FormulaR1C1 = _
"=CHOOSE(R[-4]C,Eins,Zwei,Drei,Vier,Fünf,Sechs,Sieben,Acht,Neun)"
Range("D10").Select
ActiveCell.FormulaR1C1 = ""
Range("D10:F12").Select
Selection.FormulaArray = _
"=CHOOSE(R[-4]C,Eins,Zwei,Drei,Vier,Fünf,Sechs,Sieben,Acht,Neun)"
Range("C1:G3").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
With Selection.Font
.ThemeColor = xlThemeColorAccent6
.TintAndShade = 0.599993896298105
End With
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent6
.TintAndShade = 0.399975585192419
.PatternTintAndShade = 0
End With
With Selection.Font
.Color = -16727809
.TintAndShade = 0
End With
With Selection.Font
.Name = "Times New Roman"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16727809
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
ActiveCell.FormulaR1C1 = "Würfelspaß"
Range("C1:G3").Select
Selection.Font.Size = 12
Selection.Font.Size = 14
Selection.Font.Size = 16
Selection.Font.Size = 18
Selection.Font.Size = 20
Selection.Font.Size = 22
Selection.Font.Size = 24
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("C17").Select
ActiveCell.FormulaR1C1 = "Viel Spaß :-)"
Range("D20").Select
End Sub
so sieht das ganze aus. Fällt euch vielleicht etwas auf?
Danke vorab!
Liebe Grüße