Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Writing a matrix function a noticed that the real selection is one row and
one column bigger then the selection pointed by the user of that function So, reading out the selection (and coping it in an other array) it starts with values above and left from the selection pointed by the user I found this confusing, but the problem is that a selection made at the edge of the sheet (row 1 or column A) is not possible. It only produces errors My question is, if this is not the proper way to readout the values of the selected cells? Herby you will find a function I wrote to demonstrate this phenomena. Function SelectionControl(Selection As Range) As Variant Dim ArrSelect() 'Reproduce all the cells that are selected 'But it seems that one row above and one column left 'are added to the selection really made 'A problem acquire when the selection starts at row "1" 'or at column "A", then only errors "#VALUE!" are the result Dim Ra, Ka As Integer Dim i, j As Integer Dim ReturnColumn As Boolean Ra = Application.Caller.Rows.Count Ka = Application.Caller.Columns.Count Rz = Selection.Rows.Count Kz = Selection.Columns.Count ReDim ArrSelect(Ra, Ka) For j = 0 To Rz For i = 0 To Kz ArrSelect(j, i) = Selection(j, i) Next i Next j SelectionControl = ArrSelect End Function -- Peter |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Matrix selection | Excel Discussion (Misc queries) | |||
out of memory problem! what to do for large matrix operations? | Excel Programming | |||
Excel problem with dynamic matrix with a name | Excel Programming | |||
Matrix Problem | Excel Discussion (Misc queries) | |||
vba problem lookup in a matrix | Excel Programming |