Hi Everyone,
I'm hoping this is an easy fix. I'm running a for loop that I want to overwrite a cell when a specific criteria is met.
Unfortunitly I am getting an error on the one line of code.
Can you help me out.
Thanks
![]()
Sub AddRunTime() ' ' ' Dim JobNameCell As String, HoursCell JobNameCell = "B" '<======****** Change ****** HoursCell = "F" '<======****** Change ****** Range("B1").Select 'Set start position Dim lcell As Long For lcell = 1 To Range(JobNameCell & Rows.Count).End(xlUp).Row 'Set the range for the loop If Range(HoursCell & lcell) = "--------" Then If Range(JobNameCell & lcell).Offset(1) <> "" Then Range(JobNameCell & lcell).Offset(1).EntireRow.Insert End If Range(JobNameCell & lcell + 1).Value = "==================" '<-------- This line gives me an error **** End If Next lcell End Sub
Bookmarks