Re: "Flipping" a matrix
- From: "Jim Cone" <jim.coneXXX@xxxxxxxxxx>
- Date: Sun, 5 Feb 2006 05:42:39 -0800
kIc,
Thanks for your comments.
I like your approach, but as a general practice will not
write code that won't run in xl97 (assigning to arrays).
And yes, I have also discovered that one cannot assume
writing a Variant(containing an array) or Arrays directly
to a range is faster then plunking data directly in each cell.
If I was starting over with it, I believe that filling an index
row and sorting would be the way to go.
Regards,
Jim Cone
San Francisco, USA
"keepITcool" <xrrcvgpbby@xxxxxxxxx> wrote in message news:xn0ei4bgt2thdkv00ckeepitcoolnl@xxxxxxxxxxxxxxxxxxxxx
Jim,
I love your select case for the verification process, a gem!
BUT:
Using FormulaR1C1 iso FormulaLocal will screwup fewer formulas
(personally i avoid all Local string like the plague, more important
to use r1c1)
FWIW:
Textually confusing:
vbYes to Reverse Column data
to the programmer means flip the data in each column,
but to a user "Yes to Flip ROWS" is clearer.
No to flip COLUMNS" is probably clearer.
When a user breaks you should finish flipping at least the current
column. (I'd use an intermediate array(1 to rows,1 to 1) to cache the
"writedata" and avoid writing to single ranges
Following code uses 2 arrays
and can be copied into your routine...
(drawback: the writing part may be unresponsive)
Dim DataArray(), lRow&, lCol&
Application.StatusBar = "Reading"
DataArray = Rng.FormulaR1C1
ReDim CellArray(1 To Rws, 1 To Cols)
Application.StatusBar = "Flipping"
For lRow = 1 To Rws
For lCol = 1 To Cols
If Response = vbNo Then
CellArray(lRow, Cols + 1 - lCol) = DataArray(lRow, lCol)
Else
CellArray(Rws + 1 - lRow, lCol) = DataArray(lRow, lCol)
End If
Next
Next
Application.StatusBar = "Writing Flipped data"
Rng.FormulaR1C1 = CellArray
--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam
Jim Cone wrote :
John,.
You are about the first person in about 4 years (that I know about)
that has had any interest in flipping a range. Maybe you or somebody
can use this code. I like Tom's idea of just sorting the data, but
this works and it is turnkey...
- Follow-Ups:
- Re: "Flipping" a matrix
- From: Peter T
- Re: "Flipping" a matrix
- References:
- "Flipping" a matrix
- From: John Wirt
- Re: "Flipping" a matrix
- From: Jim Cone
- Re: "Flipping" a matrix
- From: keepITcool
- "Flipping" a matrix
- Prev by Date: Re: close all other workbooks
- Next by Date: How to know the linked cell of a check box
- Previous by thread: Re: "Flipping" a matrix
- Next by thread: Re: "Flipping" a matrix
- Index(es):
Relevant Pages
|