LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Number Stored as Text Issue

No joy; still getting the green triangles in the upper left corner of each
cell.

I get the results without the green triangles when I use a for next loop to
write the array element to the appropriate cell in the worksheet.

The results in the MaterialTbl array are numbers but there is text in one
column. By the way, MaterialTbl is defined as variant. For some reason the
range method treats the all values in the array as text and the loop method
recognizes the diference between numbers and text.

Thanks,
Raul


"Jim Thomlinson" wrote:

Try...
with Worksheets(ThisSheet)
Set DestRange = .Range(.Cells(3, 3), _
.Cells(clng(UBound(MaterialTbl, 1)), _
3 + clng(UBound(MaterialTbl, 2)) - 1))
end with


--
HTH...

Jim Thomlinson


"Raul" wrote:

UBound(MaterialTbl, 1) = 1296
UBound(MaterialTbl, 2) = 8

Raul

"Jim Thomlinson" wrote:

Sorry about that...

What are the values of
UBound(MaterialTbl, 1)
3 + UBound(MaterialTbl, 2) - 1
--
HTH...

Jim Thomlinson


"Raul" wrote:

I'm pretty sure the range() is working and two arguments are being passed
(all open parentheses and close parentheses make it very messy).

The specified range is being populated, but I'm getting a green triangle in
the upper left corner of each cell flagging the "Number Stored as Text" error
when I use the range() method.

By the way I have used the range method in a number of other routines
without running into this issue.

Thanks,
Raul

"Jim Thomlinson" wrote:

Without looking too closely at exactly what you are trying to do there is an
obvious mistake in the first code. Range() requires 1 argument and can take
an optional second argument. You have supplied 3 arguments. It has no idea
what to do with 3 arguments.
--
HTH...

Jim Thomlinson


"Raul" wrote:

I'm using a routine to retreive data from a SQL Server database and then
output the results to a worksheet. MaterialTbl is a variant array.

The issue is I get a "Number stored as text" error when I use:

Set DestRange = Range(Worksheets(ThisSheet).Cells(3, 3), _
Worksheets(ThisSheet).Cells(UBound(MaterialTbl, 1), _
3 + UBound(MaterialTbl, 2) - 1))

DestRange.Value = MaterialTbl

But I don't get the error if I use:

For i = 0 To UBound(MaterialTbl, 1)
For j = 1 To UBound(MaterialTbl, 2)
Worksheets(ThisSheet).Cells(3+ i, 3 + j - 1).Value = MaterialTbl(i, j)
Next j
Next i

Why would I get an error with the first method and not get an error with the
latter?

Thanks in advance,
Raul

 
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
Number Stored as Text. musa.biralo Excel Programming 2 March 8th 07 09:03 PM
Number stored as text Justin[_14_] Excel Programming 1 November 6th 06 08:16 PM
Number stored as text Prashwee Excel Programming 3 March 15th 06 11:22 AM
Number stored as text Andrew Clark Excel Discussion (Misc queries) 1 November 8th 05 10:25 PM
Number stored as text sueanne Excel Discussion (Misc queries) 1 March 2nd 05 10:56 PM


All times are GMT +1. The time now is 01:19 AM.

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"