Ironman
Well-known Member
- Joined
- Jan 31, 2004
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
The below code runs in a worksheet_change event but I specifically only want it to run when the word "OTHER" is entered in Column B of the first filled row (same row as the one in the code) AND Column J of the same row begins with the text "Indoor bike session".
Hope you can help?
Many thanks!
The below code runs in a worksheet_change event but I specifically only want it to run when the word "OTHER" is entered in Column B of the first filled row (same row as the one in the code) AND Column J of the same row begins with the text "Indoor bike session".
VBA Code:
Dim NextRow As Long
Application.EnableEvents = False
If ActiveSheet.Name = "Training Log" Then
NextRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & NextRow).Resize(, 6).Interior.Color = RGB(197, 217, 241)
Range("I" & NextRow).Resize(, 2).Interior.Color = RGB(197, 217, 241)
Range("I" & NextRow).Value = "Indoor bike session, 60 mins."
Range("A" & NextRow).Select
Else
MsgBox "Cell fill does not work in this sheet", vbInformation, "Information"
End If
lr = Range("A" & Rows.Count).End(xlUp).Row
If target.Address(0, 0) = Range("B" & lr).Address(0, 0) Then
Range("F" & lr).Select
MsgBox "Enter heart rate", vbInformation, "Indoor Bike Session Data"
Application.EnableEvents = True
End If
Hope you can help?
Many thanks!
Last edited: