Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi good morning, please can you help me I have the 2 codes below one for the update button where it updates and finds the ID number in sheet 1 and updates the data into the correct cells, but it should also colour code that line once updated if a specific textbox has data in it. But what it is doing is updating the correct cells with the ne data but the colour code is update on a newline, and not for the row where h data has been updated. Please can you help me please? I am so stuck on this.
Code for update button below.
Colour code below.
Code for update button below.
Code:
Private Sub CommandButton1_Click()
Dim Found As Range
If Me.TextBox18.value = "" Then
MsgBox "No MPAN Found ", , "Missing Entry"
Else
Set Found = Sheets("Sheet1").Range("G:G").Find(What:=Me.TextBox18.value, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Found Is Nothing Then
MsgBox "No match for " & Me.TextBox18.value, , "No Match Found"
Else
Found.Offset(emptyRow, 8).value = Me.ComboBox1.value
Found.Offset(emptyRow, 9).value = Me.TextBox19.value
Found.Offset(emptyRow, 10).value = Me.TextBox15.value
Found.Offset(emptyRow, 11).value = Me.TextBox16.value
Found.Offset(emptyRow, 12).value = Me.TextBox17.value
End If
End If
End Sub
Colour code below.
Code:
Private Sub ComboBox1_Change()
With ThisWorkbook.Sheets("Sheet1")
emptyRow = .Cells(Rows.Count, "H").End(xlUp).Row + 1
If ComboBox1.value = "Yes" Then Range(.Cells(emptyRow, 1), .Cells(emptyRow, 19)).Interior.Color = RGB(255, 255, 0)
If ComboBox1.value = "No" Then Range(.Cells(emptyRow, 1), .Cells(emptyRow, 19)).Interior.Color = RGB(147, 112, 219)
End With
End Sub