Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Portuguese Social Format NOT desired

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.....

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Portuguese Social Format NOT desired

Do you have an error in column A?

If not what's in the cell that causes the error?

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Portuguese Social Format NOT desired

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
  #4   Report Post  
Posted to microsoft.public.excel.programming
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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Portuguese Social Format NOT desired

I'd drop the double quotes:
ElseIf ActiveCell.Offset(0, -2).Value = "0"
becomes:
ElseIf ActiveCell.Offset(0, -2).Value = 0

And test it out.

Kigol wrote:

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


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Portuguese Social Format NOT desired

On Oct 11, 5:13 pm, Dave Peterson wrote:
I'd drop the double quotes:
ElseIf ActiveCell.Offset(0, -2).Value = "0"
becomes:
ElseIf ActiveCell.Offset(0, -2).Value = 0

And test it out.





Kigol wrote:

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


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Tried that. Tried removing the .Value. Tried all possible
combinations. When I do =Cell=0 on the sheet directly it returns TRUE
so I know it is a zero value. For some reason VBA isn't seeing it that
way.....

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Portuguese Social Format NOT desired

Maybe it's time to make sure you're looking at the cell that you really want:

msgbox activecell.offset(0,-2).value & vblf & activecell.offset(0,-2).address

Pepper a few of those into your code to check things out.

Kigol wrote:

On Oct 11, 5:13 pm, Dave Peterson wrote:
I'd drop the double quotes:
ElseIf ActiveCell.Offset(0, -2).Value = "0"
becomes:
ElseIf ActiveCell.Offset(0, -2).Value = 0

And test it out.





Kigol wrote:

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


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Tried that. Tried removing the .Value. Tried all possible
combinations. When I do =Cell=0 on the sheet directly it returns TRUE
so I know it is a zero value. For some reason VBA isn't seeing it that
way.....


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Portuguese Social Format NOT desired

On Oct 11, 8:37 pm, Dave Peterson wrote:
Maybe it's time to make sure you're looking at the cell that you really want:

msgbox activecell.offset(0,-2).value & vblf & activecell.offset(0,-2).address

Pepper a few of those into your code to check things out.





Kigol wrote:

On Oct 11, 5:13 pm, Dave Peterson wrote:
I'd drop the double quotes:
ElseIf ActiveCell.Offset(0, -2).Value = "0"
becomes:
ElseIf ActiveCell.Offset(0, -2).Value = 0


And test it out.


Kigol wrote:


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


--


Dave Peterson- Hide quoted text -


- Show quoted text -


Tried that. Tried removing the .Value. Tried all possible
combinations. When I do =Cell=0 on the sheet directly it returns TRUE
so I know it is a zero value. For some reason VBA isn't seeing it that
way.....


--

Dave Peterson- Hide quoted text -

- Show quoted text -


After you said that I went back and checked. The zeros in the offset
statements should be variable z instead to make them dynamic. Wow
can't believe I missed that. Thanks for the hlp Dave. Cheers.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Input box accepting only desired format Amitriumphs Excel Programming 1 May 31st 07 04:21 AM
How do I format a social security number to have no dashes? Kim Excel Discussion (Misc queries) 5 July 17th 06 10:13 PM
format social security number Kristy Excel Worksheet Functions 2 September 9th 05 04:13 PM
Social Security Number format Jean Excel Worksheet Functions 1 March 7th 05 09:37 PM
format social security number as XXX-XX-1234 Svetlana Excel Programming 4 January 21st 04 11:59 PM


All times are GMT +1. The time now is 07:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"