LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem with a selection in a matrix-function

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
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
Matrix selection Marco Rod Excel Discussion (Misc queries) 4 March 27th 10 02:23 PM
out of memory problem! what to do for large matrix operations? MCM[_2_] Excel Programming 4 June 18th 06 02:11 PM
Excel problem with dynamic matrix with a name jgmiddel[_7_] Excel Programming 0 April 3rd 06 11:31 PM
Matrix Problem Jeff Excel Discussion (Misc queries) 1 February 4th 06 07:36 PM
vba problem lookup in a matrix Jean-Pierre D via OfficeKB.com Excel Programming 6 September 1st 05 07:09 PM


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