Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Unwanted conversion from Null to Zero

I am missing something...

A zero value eventually shows in the spreadsheet as zero.

Let me explain: my Function has a Range (a vertical vector) as a
parameter. The range may contain empty cells. The range is then
converted to a Variant that contains an array. The function puts all
the Null (empty) values at the bottom of the array. Till here
everything is fine.

But in the spreadsheet, instead of empty cells I see zeroes, which is
wrong. What am I missing?

Function Igual2(Rng As Range) As Variant
Dim Vector() As Variant
Dim i As Integer, j As Integer
Vector = Rng.Value
i = UBound(Vector, 1)
ReDim Preserve Vector(1 To i, 1 To 2)
For j = 1 To i
Vector(j, 2) = j
Next j
Vector = NullsAtTheBottom(Vector)
....
Igual2 = Vector
End Function
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Unwanted conversion from Null to Zero

You need to post the code of NullsAtTheBottom.

RBS


"vsoler" wrote in message
...
I am missing something...

A zero value eventually shows in the spreadsheet as zero.

Let me explain: my Function has a Range (a vertical vector) as a
parameter. The range may contain empty cells. The range is then
converted to a Variant that contains an array. The function puts all
the Null (empty) values at the bottom of the array. Till here
everything is fine.

But in the spreadsheet, instead of empty cells I see zeroes, which is
wrong. What am I missing?

Function Igual2(Rng As Range) As Variant
Dim Vector() As Variant
Dim i As Integer, j As Integer
Vector = Rng.Value
i = UBound(Vector, 1)
ReDim Preserve Vector(1 To i, 1 To 2)
For j = 1 To i
Vector(j, 2) = j
Next j
Vector = NullsAtTheBottom(Vector)
...
Igual2 = Vector
End Function


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Unwanted conversion from Null to Zero

You can go to ToolsOptionsView and uncheck "zero values". Excel otherwise
will convert null to zero.

"vsoler" wrote:

I am missing something...

A zero value eventually shows in the spreadsheet as zero.

Let me explain: my Function has a Range (a vertical vector) as a
parameter. The range may contain empty cells. The range is then
converted to a Variant that contains an array. The function puts all
the Null (empty) values at the bottom of the array. Till here
everything is fine.

But in the spreadsheet, instead of empty cells I see zeroes, which is
wrong. What am I missing?

Function Igual2(Rng As Range) As Variant
Dim Vector() As Variant
Dim i As Integer, j As Integer
Vector = Rng.Value
i = UBound(Vector, 1)
ReDim Preserve Vector(1 To i, 1 To 2)
For j = 1 To i
Vector(j, 2) = j
Next j
Vector = NullsAtTheBottom(Vector)
....
Igual2 = Vector
End Function

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Unwanted conversion from Null to Zero

On 1 sep, 00:57, "RB Smissaert"
wrote:
You need to post the code of NullsAtTheBottom.

RBS

"vsoler" wrote in message

...

I am missing something...


A zero value eventually shows in the spreadsheet as zero.


Let me explain: my Function has a Range (a vertical vector) as a
parameter. The range may contain empty cells. The range is then
converted to a Variant that contains an array. The function puts all
the Null (empty) values at the bottom of the array. Till here
everything is fine.


But in the spreadsheet, instead of empty cells I see zeroes, which is
wrong. What am I missing?


Function Igual2(Rng As Range) As Variant
Dim Vector() As Variant
Dim i As Integer, j As Integer
Vector = Rng.Value
i = UBound(Vector, 1)
ReDim Preserve Vector(1 To i, 1 To 2)
For j = 1 To i
*Vector(j, 2) = j
Next j
Vector = NullsAtTheBottom(Vector)
...
Igual2 = Vector
End Function


Here is the code for NullsAtTheBottom: what's wrong with it?

Function NullsAtTheBottom(List()) As Variant
Dim First As Integer, Last As Integer
Dim i As Integer, j As Integer
Dim Temp
First = LBound(List)
Last = UBound(List)
For i = 1 To Last - 1
If List(i, 1) = "" Then
For j = i + 1 To Last
If List(j, 1) < "" Then
Temp = List(j, 1)
List(j, 1) = List(i, 1)
List(i, 1) = Temp
End If
Next j
End If
Next i
NullsAtTheBottom = List
End Function
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
Unwanted data conversion in cells WordsmithDan Excel Discussion (Misc queries) 2 July 6th 07 12:34 AM
Unwanted number format conversion Allen_N Excel Programming 10 June 6th 07 08:42 PM
unwanted csv date conversion Lori Gordon Excel Discussion (Misc queries) 1 October 10th 05 11:02 PM
unwanted number to date conversion while pasting data from web Jacek Excel Worksheet Functions 1 February 24th 05 02:59 PM
Unwanted date conversion when opening a workbook Rob Excel Programming 2 June 2nd 04 04:05 PM


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