Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Swapping Values

Thanks Ron,

I got that to work OK

The "Sort" is really a re-arrangement of data in line with pre-defined
criteria.
I can't imagine an Excel way of doing it.
The table is at most 20 rows by 8 columns.
Although many iterations are sometimes required, it doesn't take long.
In fact, I needed to view and check results in progress - to do this
effectively I had to include a delaying loop to slow things down.
Having said that I have only tested up to 12 rows by 8 columns - if it slows
down too much with 20 rows, I'll take your advice and use an array.

Thanks again,
Don

"keepITcool" wrote in message
...

if the ranges are similar size then use a 'standard'
swap approach like:

dim v
v = rng1.value
rng1.value = rng2.value
rng2.value = v

What i dont understand that IF you write a sort routine,
you make 'intermediate writes' to cells..
which imho would make it unacceptably slow.


I'd EITHER let excel do all the work

OR
I'd read the entire range into an array.
Then SORT the array
Then WRITE the sorted array back to the range.

keepITcool


< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Don Lloyd" wrote :

Hi,

I'm working on a customised sort routine which involves swapping
values within a table.
Uing a temporary variable, single cells are not a problem, but what's
the best way to work with multiple cells. The code is in R1C1
notation.

Example
Swap Row 10, Columns 5 to 8
With Row 15, Columns 5 to 8

What I would like to be able to do is to complete the swap using one
temporary variable.

Regards,
Don Lloyd






Reply
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
Swapping headers Darren Charts and Charting in Excel 2 January 25th 10 06:51 PM
swapping axis' baltobernie Charts and Charting in Excel 5 June 25th 09 02:42 AM
Swapping Columns mePenny Excel Discussion (Misc queries) 3 April 22nd 09 09:25 PM
swapping fomulas for values tantrum9 Excel Discussion (Misc queries) 1 April 11th 07 01:49 AM
swapping columns?? Johnny D Excel Discussion (Misc queries) 0 February 15th 06 07:13 PM


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