Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Value of True etc

Hi

from Chip Pearson's site (I think) I got the following code:

Function ColumnLetter(R As Range) As String
ColumnLetter = Left(R.Address(False, False), _
1 - (R.Column 26) - (R.Column 702))
End Function

I was dead impressed as it does the trick in getting the column letters out
in Excel 2007 etc

My question is that the value true must have a value of minus one whereas I
thought it was nought as in Excel formulae. Can anyone give a simple
explanation, please?

Many thanks

Tim

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Value of True etc

hi Tim,

ActiveCell :
cln = Evaluate("SUBSTITUTE(SUBSTITUTE(ADDRESS(1,COLUMN() ),""$"",""""),""1"","""")")

ActiveCell.Offset(,1) :
cln = Evaluate("SUBSTITUTE(SUBSTITUTE(ADDRESS(1,COLUMN() +1),""$"",""""),""1"","""")")

ActiveCell.Offset(,-1) :
cln = Evaluate("SUBSTITUTE(SUBSTITUTE(ADDRESS(1,COLUMN()-1),""$"",""""),""1"","""")")

--
isabelle

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Value of True etc

hi Isabelle

Not sure why you sent me these long formulae?

bw

Tim

"isabelle" wrote in message ...
hi Tim,

ActiveCell :
cln =
Evaluate("SUBSTITUTE(SUBSTITUTE(ADDRESS(1,COLUMN() ),""$"",""""),""1"","""")")

ActiveCell.Offset(,1) :
cln =
Evaluate("SUBSTITUTE(SUBSTITUTE(ADDRESS(1,COLUMN() +1),""$"",""""),""1"","""")")

ActiveCell.Offset(,-1) :
cln =
Evaluate("SUBSTITUTE(SUBSTITUTE(ADDRESS(1,COLUMN()-1),""$"",""""),""1"","""")")

--
isabelle



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Value of True etc

First off, here is a simpler function to use...

Function ColumnLetter(R As Range) As String
ColumnLetter = Split(R.Address, "$")(1)
End Function

As to your question... True in VBA is -1, False is 0 whereas in Excel
worksheet functions, TRUE is +1 and FALSE is 0.

Rick Rothstein (MVP - Excel)

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Value of True etc

Rick Rothstein has brought this to us :
First off, here is a simpler function to use...

Function ColumnLetter(R As Range) As String
ColumnLetter = Split(R.Address, "$")(1)
End Function

As to your question... True in VBA is -1, False is 0 whereas in Excel
worksheet functions, TRUE is +1 and FALSE is 0.

Rick Rothstein (MVP - Excel)


Note that Excel worksheet functions consider TRUE as any value 0.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Value of True etc

Hi Rick

Many thanks for neat alternative - very elegant, which is always good.
Thanks too for answer to initial question.

Best wishes

Tim

"Rick Rothstein" wrote in message
...
First off, here is a simpler function to use...

Function ColumnLetter(R As Range) As String
ColumnLetter = Split(R.Address, "$")(1)
End Function

As to your question... True in VBA is -1, False is 0 whereas in Excel
worksheet functions, TRUE is +1 and FALSE is 0.

Rick Rothstein (MVP - Excel)



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
if any of 3 conditions is true, then answer is true inthestands Excel Worksheet Functions 5 November 16th 06 12:02 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
How do I stop Excel from changing the word true to TRUE? Schmyerlou Excel Discussion (Misc queries) 1 November 23rd 05 08:54 PM
Reverse false and combine with true true value Emmie99 Excel Worksheet Functions 5 August 17th 05 04:38 PM


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

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

About Us

"It's about Microsoft Excel"