View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
freshforlife freshforlife is offline
external usenet poster
 
Posts: 8
Default Help needed with Excel VBA sort

Hi Guys,

I am trying to sort a range of cells using VBA inside an excel
application using this code:

Worksheets(ProdGeog).Range("B" & gchk1 & ":M" & gchk2).Sort _
Key1:=Worksheets(ProdGeog).Range("J" & gchk1),
Order1:=xlDescending, _
Key2:=Worksheets(ProdGeog).Range("I" & gchk1),
Order2:=xlAscending, _
Key3:=Worksheets(ProdGeog).Range("B" & gchk1),
Order3:=xlAscending, _
Header:=xlNo

This sort is used to update certain graphs in the application.

If I run the whole application, it doesn't sort properly, however if I
debug the subroutine using F8 ( step-by-step iteration), it sorts
correctly.

Any pointers as to why it doesn't do it in the first place.

Thanks,
Ravi