Eddie_th
08-09-2016, 01:22 PM
Hello!
I am implementing a code for the immediate window because I have a costumer who needs to copy and paste dates. But when he does, the dates are modified by 4 years and 1 day. Therefore I want to show him how he can get rid of this.
My idea was to select the cells containing the wrong dates and then use the immediate window. The problem is when we select cells which do not contain dates. It may sound rendundant, but it is not. For example, if we have several cells without dates between our cells with dates, something like this:
01-01-2016
01-01-2016
01-01-2016
Absent
Absent
01-01-2016
Absent
01-01-2016
.
.
.
It is easier to just select all the column instead of using the CTRL+Click method. Therefore, I was using the following code in the immediate window but I get a Next without For error:
For Each cell In Selection:if IsNumeric(cell.Value)=True then cell.Value=cells.Value+1462:Next cell
I am implementing a code for the immediate window because I have a costumer who needs to copy and paste dates. But when he does, the dates are modified by 4 years and 1 day. Therefore I want to show him how he can get rid of this.
My idea was to select the cells containing the wrong dates and then use the immediate window. The problem is when we select cells which do not contain dates. It may sound rendundant, but it is not. For example, if we have several cells without dates between our cells with dates, something like this:
01-01-2016
01-01-2016
01-01-2016
Absent
Absent
01-01-2016
Absent
01-01-2016
.
.
.
It is easier to just select all the column instead of using the CTRL+Click method. Therefore, I was using the following code in the immediate window but I get a Next without For error:
For Each cell In Selection:if IsNumeric(cell.Value)=True then cell.Value=cells.Value+1462:Next cell