View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Kigol Kigol is offline
external usenet poster
 
Posts: 36
Default Portuguese Social Format NOT desired

On Oct 11, 1:43 pm, Dave Peterson wrote:
ps. What version of excel are you using?

Kigol wrote:

I convert an entire column of 9 digit identifiers using:


Columns("A:A").NumberFormat = "000000000"


I then try to compare the resulting values cell by cell to Zero. I get
a type mismatch error and when I check the cell formatting in excel it
is formatted under "Special" as a Portuguese Social Security Number.
I'm at a loss.....


--

Dave Peterson


Well I discovered the type mismatch problem was due to another issue.
But when I try to test the cell value with the following code it skips
over the condition as if there is something besides zero in the cell.

For z = 0 To x
Range("C2").Select

If IsEmpty(ActiveCell.Offset(z, 0)) Then '<---Tests for empty cell to
be populated

If IsEmpty(ActiveCell.Offset(0, -2)) Then '<---Tests for empty cells
in column A
ActiveCell.Offset(z, 0).FormulaR1C1 =
"=IF(ISNA(VLOOKUP(RC[-1],Symbols!C[-1]:C,
2,0)),VLOOKUP(TRIM(RC[-1]),Symbols!C[-1]:C,2,0),VLOOKUP(RC[-1],Symbols!
C[-1]:C,2,0))"

ElseIf ActiveCell.Offset(0, -2).Value = "0" Then '<b<-----------THIS
IS THE CONDITION I AM TRYING TO TEST<b

ActiveCell.Offset(z, 0).FormulaR1C1 =
"=IF(ISNA(VLOOKUP(RC[-1],Symbols!C[-1]:C,
2,0)),VLOOKUP(TRIM(RC[-1]),Symbols!C[-1]:C,2,0),VLOOKUP(RC[-1],Symbols!
C[-1]:C,2,0))"

Else <-If there are no empty cells use this cell as reference.

ActiveCell.Offset(z, 0).FormulaR1C1 =
"=IF(ISNA(VLOOKUP(RC[-2],Symbols!C[-2]:C,
3,0)),VLOOKUP(TRIM(RC[-2]),Symbols!C[-2]:C,3,0),VLOOKUP(RC[-2],Symbols!
C[-2]:C,3,0))"

End If
End If
Next z