Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Assigning values to adjacent cells from a function | Excel Worksheet Functions | |||
Assigning values from source cells | Excel Programming | |||
Assigning values to other cells from one cells formula | Excel Discussion (Misc queries) | |||
Assigning new values to charts | Excel Programming | |||
Problem assigning values to a range of cells | Excel Programming |