How to swap rows - rapidly?

  • Thread starter Thread starter count
  • Start date Start date
C

count

Hi,
How to swap adjacent rows?
Needs to work more efficiently than looping through cells.
Purpose is to give user SpinUp/SpinDown to manipulate dropdown lists
(multicol)
So nifty solutions for management of namedRanges are welcome too!
TIA
Paul
 
To move up:

Selection.EntireRow.Cut
Selection.Offset(-1).Insert xlShiftDown
Selection.Offset(-1).Select

To move down:

Selection.EntireRow.Cut
Selection.Offset(2).Insert xlShiftDown
Selection.Offset(1).Select

You will need error-checking for the range extremities.
 
It sounds like what you need to do is to store the entries for your combo
box in an array and set the combox list to the array versus what I suspect
you are doing, which is using the row source property to set the list.
Array manipulations are far faster and setting a list by an array should be
faster than use of row source.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top