Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text returned as 0

Hi,

I've having various problems with my VBA functions, and
came to writing this test functoin to see what the .Text
property is set to:

Function GetText(IRange As Range) As Long
If (Not IsEmpty(cl)) Then
GetText = IRangeText
End If
End Function

(My column A is a list of numbers)
I called this function from the correct spreadsheet
with "A2" (without the speech marks) as the argument. The
visible contents of the cell is "761", but the function
returned "0". I cannot figure out why this is happening.
(I know the range is valid as well)

(Replacing .Text with .Value makes no difference).

Thanks in advance,
Chris


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text returned as 0

(by the way- i meant to write the line in the prog as
IRange.Text)
-----Original Message-----
Hi,

I've having various problems with my VBA functions, and
came to writing this test functoin to see what the .Text
property is set to:

Function GetText(IRange As Range) As Long
If (Not IsEmpty(cl)) Then
GetText = IRangeText
End If
End Function

(My column A is a list of numbers)
I called this function from the correct spreadsheet
with "A2" (without the speech marks) as the argument. The
visible contents of the cell is "761", but the function
returned "0". I cannot figure out why this is happening.
(I know the range is valid as well)

(Replacing .Text with .Value makes no difference).

Thanks in advance,
Chris


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Text returned as 0

Did you really have:
GetText = IRange.Text
??

And you said you wanted to return a long.
Function GetText(IRange As Range) As Long
(I think I'd use a Variant so I could use it with non-numeric cells).

And you check: Isempty(c1)
Didn't you mean: if (not isempty(irange)) then

And just curious, why not:
=a1
or
=if(a1="","",a1)


This worked ok for me:

Option Explicit
Function GetText(IRange As Range) As Variant
Set IRange = IRange(1)
If (Not IsEmpty(IRange)) Then
GetText = IRange.Text
Else
GetText = ""
End If
End Function






Chris wrote:

Hi,

I've having various problems with my VBA functions, and
came to writing this test functoin to see what the .Text
property is set to:

Function GetText(IRange As Range) As Long
If (Not IsEmpty(cl)) Then
GetText = IRangeText
End If
End Function

(My column A is a list of numbers)
I called this function from the correct spreadsheet
with "A2" (without the speech marks) as the argument. The
visible contents of the cell is "761", but the function
returned "0". I cannot figure out why this is happening.
(I know the range is valid as well)

(Replacing .Text with .Value makes no difference).

Thanks in advance,
Chris



--

Dave Peterson

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
CAN A VALUE BE RETURNED WHEN TEXT IS ENTERED IN A DIFFERANT CELL? AL Excel Worksheet Functions 1 January 31st 10 08:39 PM
Resizing cells to fit text returned by VLOOKUP Michelle Excel Discussion (Misc queries) 10 September 4th 09 02:10 AM
Resizing cells to fit text returned by VLOOKUP Michelle Excel Worksheet Functions 10 September 4th 09 02:10 AM
text being returned as ####### ACICS_Admin Excel Discussion (Misc queries) 4 December 19th 08 03:15 PM
How do I convert cells containing formulas to text (value returned Kim Excel Worksheet Functions 4 March 28th 05 09:17 PM


All times are GMT +1. The time now is 12:28 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"