Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
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 | Excel Discussion (Misc queries) | |||
Search for 2 true arguments and return true or false | Excel Discussion (Misc queries) | |||
Function to return True/False if all are validated as True by ISNU | Excel Worksheet Functions | |||
Reverse false and combine with true true value | Excel Worksheet Functions | |||
True Or False, no matter what... it still displays the false statement | Excel Programming |