Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi NG
Testdata 0E560 0E310 000 00 0 1 I have experienced an odd problem. In a cell, I have this information: 0E560 I'm testing cells for Zero's and the above cell contains Zero. Why? Macro belowe is my way to solve the probleme. Is there a more elegant way? Option Explicit Sub test() Dim cell As Range For Each cell In Selection '// Why zero?? Dim TestCVdig As Double TestCVdig = Trim(cell.Value) '// Only trim zero: 0 Dim TestCV As String TestCV = Trim(cell.Value) Dim TestCVReplace As String TestCVReplace = Replace(TestCV, "0", "") If (Len(TestCV) < Len(TestCVReplace) And _ Len(TestCV) 1 And Len(TestCVReplace) = 0) Or _ TestCV = "0" Then Stop '// Function 'ZeroTRIMCount cell End If Next cell End Sub -- Best regards Joergen Bondesen |