G
Guest
I am using the following formula:
With ActiveSheet
intMaxRow = .UsedRange.Rows.Count
Set rngStart = .Range("E1")
For intCtr = 1 To (intMaxRow - 1)
Set rngCell = rngStart.Offset(RowOffset:=intCtr)
If IsNumeric(rngCell) And rngCell.Value > 0 Then
On Error Resume Next
rngCell.Value = DateValue(Int(rngCell / 100) & "/1/" & rngCell Mod
100)
rngCell.NumberFormat = "mmm - yy"
On Error GoTo 0
End If
Next intCtr
End With
Set rngStart = Nothing
Set rngCell = Nothing
End Sub
Now it works great for what It was created for. However, there is something
fishy that is making it react differently then I want in another instance.
It takes data in a cell that is imported from elsewhere as a number EX: 406
and turns it into the proper date Apr - 06, or 1205 to Dec - 05 SO The
values are either 3 characters OR 4 and it works perfectly.
Now I used it on another column to try for the same results, this was my
result. The current data within the cells are all 4 characters SO ex:
1004 is supposed to be Oct - 04 or 0186 is supposed to be Jan - 86
Now I thought that formula would work the same on that column, BUT my end
result was this:
0186 turned into 1/1/1986
1004 into 10/1/2004
What's up? I want it to look like the other.....Oct - 04 and Jan - 86, etc.
Thanks in advance for the help!!!
With ActiveSheet
intMaxRow = .UsedRange.Rows.Count
Set rngStart = .Range("E1")
For intCtr = 1 To (intMaxRow - 1)
Set rngCell = rngStart.Offset(RowOffset:=intCtr)
If IsNumeric(rngCell) And rngCell.Value > 0 Then
On Error Resume Next
rngCell.Value = DateValue(Int(rngCell / 100) & "/1/" & rngCell Mod
100)
rngCell.NumberFormat = "mmm - yy"
On Error GoTo 0
End If
Next intCtr
End With
Set rngStart = Nothing
Set rngCell = Nothing
End Sub
Now it works great for what It was created for. However, there is something
fishy that is making it react differently then I want in another instance.
It takes data in a cell that is imported from elsewhere as a number EX: 406
and turns it into the proper date Apr - 06, or 1205 to Dec - 05 SO The
values are either 3 characters OR 4 and it works perfectly.
Now I used it on another column to try for the same results, this was my
result. The current data within the cells are all 4 characters SO ex:
1004 is supposed to be Oct - 04 or 0186 is supposed to be Jan - 86
Now I thought that formula would work the same on that column, BUT my end
result was this:
0186 turned into 1/1/1986
1004 into 10/1/2004
What's up? I want it to look like the other.....Oct - 04 and Jan - 86, etc.
Thanks in advance for the help!!!