#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default True False

Hi,
How do I make my Excel application read a cell value which contains either
an Excel value True or False as 1 or 0. The reason being that in another
country the True or False is oftern another word e.g. in German it is Wahr or
Falsch so I can't just take the text, I need the interpreted value 1 or 0 so
that I can use it within my VB code.

I currently read the cell calue with

aryComboBox(X) = Application.Sheets(Y).Cells(rgeSearch.Row + 1 + X,
rgeSearch.column).Value

TIA
KM

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default True False

How do I make my Excel application read a cell value which contains
either
an Excel value True or False as 1 or 0. The reason being that in another
country the True or False is oftern another word e.g. in German it is Wahr

or
Falsch so I can't just take the text, I need the interpreted value 1 or 0

so
that I can use it within my VB code.


the CBool(exp) function convertes exp (any non-boolean variable) into a
boolean. testing it with strings, it takes "True" and "False" (case
insensitive), and throws an exception for anything else. Since the other
listed Cx functions take locale into account, I would guess it would
compensate for language - you would have to test it.

Iain King


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default True False

Hi Kevin,

Would something like the following work for you?

Sub Tester02()
Dim rng As Range, rng1 As Range
Dim myVal As Variant
Dim i As Long
Dim aryComboBox As Variant

Set rng = Selection
On Error Resume Next
Set rng1 = rng.SpecialCells(xlCellTypeConstants, xlLogical)
On Error GoTo 0
'Or Set rng1 = rng.SpecialCells(xlCellTypeFormulas, xlLogical)
'Or build a union of constants and formulae

i = rng.Count
ReDim aryComboBox(1 To i)

For i = 1 To rng.Count
If Not rng1 Is Nothing Then
If Not Intersect(rng1, rng(i)) Is Nothing Then
myVal = CLng(rng(i)) * -1
End If
Else
myVal = rng(i).Value
End If
aryComboBox(i) = myVal
Next i
End Sub


---
Regards,
Norman



"Kevin McCartney" wrote in
message ...
Hi,
How do I make my Excel application read a cell value which contains either
an Excel value True or False as 1 or 0. The reason being that in another
country the True or False is oftern another word e.g. in German it is Wahr
or
Falsch so I can't just take the text, I need the interpreted value 1 or 0
so
that I can use it within my VB code.

I currently read the cell calue with

aryComboBox(X) = Application.Sheets(Y).Cells(rgeSearch.Row + 1 + X,
rgeSearch.column).Value

TIA
KM



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
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Excel Discussion (Misc queries) 9 July 29th 08 12:28 AM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
Reverse false and combine with true true value Emmie99 Excel Worksheet Functions 5 August 17th 05 04:38 PM
True Or False, no matter what... it still displays the false statement rocky640[_2_] Excel Programming 2 May 13th 04 04:57 PM


All times are GMT +1. The time now is 12:32 AM.

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"