Ironman
Well-known Member
- Joined
- Jan 31, 2004
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
I have the following code, very kindly supplied by maabadi in a module
I also have the following code in a worksheet_change event, kindly supplied by NoSparks
I just need the above sets of code to be combined as a worksheet_change event.
The code needs to start in Col C, not A as written above, because A is now copied as part of the first set of code. It then needs to jump from Col C to Col H and then Col J.
Many thanks!
I have the following code, very kindly supplied by maabadi in a module
VBA Code:
Dim Lr1 As Long, Lr2 As Long
Lr1 = Sheets("Training Log").Range("A" & Rows.Count).End(xlUp).Row
Lr2 = Sheets("Indoor Bike").Range("A" & Rows.Count).End(xlUp).Row + 1
If UCase(Trim(Left(Sheets("Training Log").Range("I" & Lr1).Value, 19))) = "INDOOR BIKE SESSION" Then
Sheets("Indoor Bike").Range("F" & Lr2 & ":G" & Lr2).Value = Sheets("Training Log").Range("F" & Lr1 & ":G" & Lr1).Value
Sheets("Indoor Bike").Range("I" & Lr2).Value = Sheets("Training Log").Range("H" & Lr1).Value
Sheets("Indoor Bike").Range("A" & Lr2).Value = Sheets("Training Log").Range("A" & Lr1).Value
Sheets("Indoor Bike").Range("B" & Lr2).Value = "1:00:00"
Sheets("Indoor Bike").Range("E" & Lr2).Value = "8"
Sheets("Indoor Bike").Range("J" & Lr2).Value = "Session "
End If
End Sub
VBA Code:
Dim NextRow As Long
lr = Range("A" & Rows.Count).End(xlUp).Row
If Target.Address(0, 0) = Range("A" & Rows.Count).End(xlUp).Address(0, 0) Then
Application.EnableEvents = False
Range("C" & Target.Row).Select 'move to this cell to start inputting data
MsgBox "Enter distance", vbInformation, "Indoor Bike Session Data"
End If
' jump from C to H on that same row
If Target.Address(0, 0) = Range("C" & lr).Address(0, 0) Then
Range("H" & lr).Select
MsgBox "Enter Average Watts", vbInformation, "Indoor Bike Session Data"
End If
If Target.Address(0, 0) = Range("H" & lr).Address(0, 0) Then
Range("J" & lr).Select
Application.EnableEvents = True
End If
The code needs to start in Col C, not A as written above, because A is now copied as part of the first set of code. It then needs to jump from Col C to Col H and then Col J.
Many thanks!