Chunk
05-19-2017, 06:32 AM
Good morning all,
I am trying to get a routine that will loop through column "L", and if the cell is NOT empty ( it will have a date, mm/dd/yyyy) calculate the difference between that date and a date in column "A" in days, and populate column "M" of the same row with the product.
Here is the code that I have (that is giving me a type mismatch error).
Sub Initial_BD_Dates()
Dim rng As Range
Dim i As Long
'Set the range in column L you want to loop through
Set rng = Range("L3:L175")
For Each cell In rng
'test if cell is empty
If cell.Value <> "" Then
'write to adjacent cell
cell.Offset(0, 1).Value = cell.Offset(0, 0).Value - cell.Offset(0, -11).Value
End If
Next
End Sub
Any ideas? Thanks in advance.
Chunk
I am trying to get a routine that will loop through column "L", and if the cell is NOT empty ( it will have a date, mm/dd/yyyy) calculate the difference between that date and a date in column "A" in days, and populate column "M" of the same row with the product.
Here is the code that I have (that is giving me a type mismatch error).
Sub Initial_BD_Dates()
Dim rng As Range
Dim i As Long
'Set the range in column L you want to loop through
Set rng = Range("L3:L175")
For Each cell In rng
'test if cell is empty
If cell.Value <> "" Then
'write to adjacent cell
cell.Offset(0, 1).Value = cell.Offset(0, 0).Value - cell.Offset(0, -11).Value
End If
Next
End Sub
Any ideas? Thanks in advance.
Chunk