View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
onlinepredator[_2_] onlinepredator[_2_] is offline
external usenet poster
 
Posts: 1
Default Sorting multiple range using a macro

Hi Kiza,

I already have lots of space in each of the ranges. I mean not al
range have contents in all their cells hence I am not sure as how t
change your code suggestion to suit my needs...... the problem is tha
i am not all that good with VB..... Thanks for yo
suggestions.

Hi Don Guillett,

I tried to copy your code into the macro and i am getting an erro
statement "Can't execute code in break mode"

heres the code

Range("A651:A670").Select
For Each c In Selection
'MsgBox c
x = Left(c, InStr(c, ":") - 1)
'MsgBox x
'Range("C1:D20").Sort Key1:=Range("C1"), Order1:=xlAscending
Range(c).Sort Key1:=Range(x), Order1:=xlAscending
Next c

A651:A670 is where i have stored all the ranges that need to b
sorted... that is A651 = C1:D20 -- A652 = C21:D40 etc

For now i am individualy sorting each range in the code......But woul
like to make the code short my looping

Dhanus

--
Message posted from http://www.ExcelForum.com