Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fomat Columns.NumberFormat for Yes No values 1

Status
Not open for further replies.

vbajock

Programmer
Jun 8, 2001
1,921
US
I need to format a column that contains 0 (for false) and -1 (for True) with Yes or No. Is there a format using columns.number format that will do this?

Thanks
 

hi,

No NumberFormat that I am aware of.

Why not in a helper column, assuming that your 0, -1 values are in column A, beginning in A2, then on row 2
[tt]
=if(A2=0,"NO",if(A2=-1,"YES",""))
[/tt]


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I'm using the "copyrecordset" method of ADO to pull the data from SQL Server, which doesn't give that much cell-by-cell control. If I use the Format Column dialog it has an option to set the column format for Yes/No values, I find it odd that it does not offer the same thing via code. I can find anything on doing it for booleans anywhere.
 

If I use the Format Column dialog it has an option to set the column format for Yes/No values
Turn on your Macro Recorder and do THAT. Then check out your recorded code. Post back with your recorded code if you need help customizing.

Let us know how things turn out.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Worked like a champ. I don't know why I didn't think of that....

xlws.colums(iCol).NumberFormat = """Yes"";""Yes"";""No"""

transforms boolean -1 0 to Yes or No.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top