LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
KAH KAH is offline
external usenet poster
 
Posts: 6
Default assigning values to cells in worksheet


I wrote the function below and received the error message 'Object variable or
With block variable not set' for the line:
wsSorting.Cells(idx, 1).Value = myArray(idx)
I think I haven't written this proplery. How do I put a value (number) into
the cell of a worksheet?
I also have a general question about using worksheets in VisualBasic. Are
they all the same or can they be virtual or real? I am using a worksheet to
sort and rank numbers but it may take too long if the worksheet is not
virtual. I also do not want to show the worksheet in Excel. I hope this makes
sense.
Thanks for any help.


Public Function Sorting(myArray() As Double) As Double
'Sorting the permutations and identifying the rank of the observed value
For idx = 1 To UBound(myArray)
wsSorting.Cells(idx, 1).Value = myArray(idx)
wsSorting.Cells(idx, 2).Value = idx
Next idx
wsSorting.Range("A:B").Sort Key1:=wsSorting.Cells(1, 1),
Order1:=xlAscending
For idx = 1 To UBound(myArray)
wsSorting.Cells(idx, 3).Value = idx
Next idx
wsSorting.Range("A:C").Sort Key1:=wsSorting.Cells(1, 2),
Order1:=xlAscending

End Function
 
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
Assigning values to adjacent cells from a function MJ_N_CO Excel Worksheet Functions 1 January 6th 09 01:40 AM
Assigning values from source cells Asif Excel Programming 1 August 12th 08 08:32 PM
Assigning values to other cells from one cells formula [email protected] Excel Discussion (Misc queries) 1 September 20th 07 07:46 PM
Assigning new values to charts freddie mac Excel Programming 0 July 18th 06 01:56 PM
Problem assigning values to a range of cells John Keith[_2_] Excel Programming 3 October 7th 05 09:00 PM


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