The problem is that you are not stating dates clearly enough for Excel. I
recommend using the date function instead of entering dates like 01/12/2007.
You would have something like:
A B C
D
------------------------------------------------------------------------
1 'Date Year Month
Day
2 '=Date(B2, C2, D2) 2007 1 12
This way
VB never makes mistakes with dates. I must admit this solution
requires you to change your workbook is written and that you might lack the
time, but consider using it on new workbooks.
--
Carlos Mallen
"Ladymuck" wrote:
Can't get this solution to work, keep getting type mismatch errors.
"Don Guillett" wrote:
From a post by Bob Phillips modified by Bernard V Liengme
Public Sub ProcessData2()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
With ActiveSheet
iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow
If IsDate(.Cells(i, TEST_COLUMN).Value) And .Cells(i,
TEST_COLUMN).Value = 0 Then
.Cells(i, TEST_COLUMN).ClearContents
End If
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Ladymuck" wrote in message
...
If I do CRTL+ H and type in 00/01/1900 and set it to replace with nothing,
it
works fine. However, when I insert the following code into my VBA project,
nothing happens. I took it straight from the good old Macro recorder!
Cells.Replace What:="00/01/1900", Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Removing the quotes automatically changed it to this, with the same
result:
Cells.Replace What:=0 / 1 / 1900, Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
What have I done wrong, or what do I need to? I know this is basically
zero
in date format but I don't want to replace everything that is 0, just
those
looking like a date
Many thanks for your help.