Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Good evening, I had some help getting to this point. Now I only need to tweak the code so rather than copy I need it to remove the value from L and place in M. The biggest problem I'm having is when it cuts it leaves the now empty cell without its filled color. I don't want this thing to touch the format.
Here is the code:
Here is the code:
VBA Code:
Sub OffsetValue()
' Declare variables
Dim lastRow As Long
Dim currentRow As Long
Dim currentValue As String
lastRow = Cells(Rows.Count, "C").End(xlUp).Row
For currentRow = 5 To lastRow
' Get the value in column C for the current row
currentValue = Cells(currentRow, "C").Value
If Mid(currentValue, 6, 2) = "TD" Or Mid(currentValue, 6, 2) = "TE" Then
If Not IsEmpty(Cells(currentRow, "L").Value) Then
' If copy the value in column L to column M
Cells(currentRow, "M").Value = Cells(currentRow, "L").Value
End If
End If
Next currentRow
End Sub