Sub Replace19xxTo20xx()
Dim myVals As Variant, i As Long
With ActiveSheet.Range("I1")
myVals = Range(.Cells, .End(xlDown)).Value2
End With
myVals = WorksheetFunction.Transpose(myVals)
For i = LBound(myVals) To UBound(myVals)
If myVals(i) Like "19##" Then myVals(i) = CLng("20" & Right$(myVals(i), 2))
Next i
ActiveSheet.Range("I1").Resize(UBound(myVals), 1).Value2 = WorksheetFunction.Transpose(myVals)
End Sub
Hello,
Given the provided informations, the sub below should give the expected results.
VBA Code:Sub Replace19xxTo20xx() Dim myVals As Variant, i As Long With ActiveSheet.Range("I1") myVals = Range(.Cells, .End(xlDown)).Value2 End With myVals = WorksheetFunction.Transpose(myVals) For i = LBound(myVals) To UBound(myVals) If myVals(i) Like "19##" Then myVals(i) = CLng("20" & Right$(myVals(i), 2)) Next i ActiveSheet.Range("I1").Resize(UBound(myVals), 1).Value2 = WorksheetFunction.Transpose(myVals) End Sub
i tried in EXCel, but ill try again..tyHello,
Well it works fine on Excel, if you are using google sheets that's a different type of macro you need to use, called AppScript. Also you're not on the right forum section if i'm not mistaken.
Hello,
Given the provided informations, the sub below should give the expected results.
VBA Code:Sub Replace19xxTo20xx() Dim myVals As Variant, i As Long With ActiveSheet.Range("I1") myVals = Range(.Cells, .End(xlDown)).Value2 End With myVals = WorksheetFunction.Transpose(myVals) For i = LBound(myVals) To UBound(myVals) If myVals(i) Like "19##" Then myVals(i) = CLng("20" & Right$(myVals(i), 2)) Next i ActiveSheet.Range("I1").Resize(UBound(myVals), 1).Value2 = WorksheetFunction.Transpose(myVals) End Sub
Can you enter the formulayah it doesnt work..i think the reason is that....the date in original form is mm/dd/yy
=ISNUMBER(A2)
Can you enter the formula
) in a blank cell and change the A2 to one of the cells containing the date and let us know whether you get TRUE or FALSE please?Excel Formula:=ISNUMBER(A2
Also can you post how your dates are displayed please? and what you see in the formula bar when you click one of the cells with a date in it?