Ich habe eine userform
erstellt und ich habe ein kleines Rätsel. Wie setze ich den Text auf einen bestimmten color
, wenn ein Wert in userform
ausgewählt wurde? Was ich tun möchte, ist, wenn der SP.Wert in der Combo-Box "Ja" ist, dann möchte ich den gesamten iRow Text rot, wenn der ST.Wert Ja ist, will ich die ganze iRow blau sein. Ich hoffe das macht Sinn? Die SP.Value und ST.Value sind beide Kombinationsfelder in der Userform mit nur Optionen von „Ja/Nein“Formatieren einer Zeile mit VBA-Benutzerform
ich den Fehler mit Objekt bin immer muss benutzerdefinierten Typ, Objekt oder Variant
Private Sub NL_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sp Br")
iRow = ws.Cells.Find(what:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
If SP.Value = "Yes" Then
With iRow
.colour = -16776961
.TintAndShade = 0
Sheets("Spec Break").Range("B2").Value = Customer.Value
Sheets("Spec Break").Range("B3").Value = Project.Value
Sheets("Spec Break").Range("B4").Value = Format(Now, ["DD/MM/YYYY"])
Sheets("Spec Break").Range("B5").Value = RSM.Value
ws.Cells(iRow, 1).Value = Cf.Value
ws.Cells(iRow, 2).Value = RT.Value
ws.Cells(iRow, 3).Value = MEqu.Value
ws.Cells(iRow, 4).Value = hmm.Value
ws.Cells(iRow, 5).Value = wmm.Value
ws.Cells(iRow, 6).Value = Opt.Value
ws.Cells(iRow, 7).Value = Tap.Value
ws.Cells(iRow, 8).Value = Fing.Value
ws.Cells(iRow, 9).Value = col.Value
ws.Cells(iRow, 10).Value = Pr.Value
ws.Cells(iRow, 11).Value = Qt.Value
End With
End If
'Insert a row beneath the data to push down footer image
ActiveCell.Offset(1).EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromRightOrAbove
ActiveCell.EntireRow.Copy
ActiveCell.Offset(1).EntireRow.PasteSpecial xlPasteFormats
Application.CutCopyMode = False
'clear form values
CustRef.Value = ""
RadType.Value = ""
MysonEquiv.Value = ""
heightmm.Value = ""
widthmm.Value = ""
Output.Value = ""
Tapping.Value = ""
Fixing.Value = ""
colour.Value = ""
Price.Value = ""
Qty.Value = ""
End Sub
sein
Ungewöhnlich vielleicht die Fehlermeldung fasst das Problem gut zusammen. Sie folgen einem 'With' Statement mit' iRow' welches ein Long ist. Vielleicht meinst du 'Rows (iRow)'? – SJR