![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Join Date: Mar 2004
Posts: 6
|
I hope this is easier to understand and that this is posted in the right place.
Cells: C6 to T61, that's the 6-row from the C-column to th T-column. Then down to 61-row. Trying to sort, ascending, by the I-column, starting at cell I6. I had a macro that worked fine and then for some reason messed up. It is now only sorting from C6 to P61. Completely ignoring columns Q, R, S and T - even though they were included when I recorded the macro. For example: Before sort: - in this example sorting by the second column. a 12 b c d 03 e f g 11 h i After sort: d 03 b c g 11 e f a 12 h i Notice that rows 3 & 4 have not changed. My question is why is it doing that and how can I fix it? |
|
|
|
|
|
#2 |
|
Join Date: Mar 2004
Posts: 6
|
Before I confuse anyone - I meant "columns 3&4", not rows.
|
|
|
|
|
|
#3 |
|
Join Date: Mar 2002
Posts: 292
|
It would really help if we could see the code to fix it
|
|
|
|
|
|
#4 |
|
Join Date: Aug 2003
Location: England
Posts: 4,584
|
Hello,
Can you post the code for this macro as well, or at least the SORTING part.
__________________
------------------------- Hope this is helpful. ------------------------- only a drafter, but broadening my Excel knowledge. |
|
|
|
|
|
#5 |
|
Join Date: Mar 2004
Posts: 6
|
Selection.Sort Key1:=Range("I6"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom |
|
|
|
|
|
#6 |
|
Join Date: Aug 2003
Location: England
Posts: 4,584
|
Hello
Sorry, I didn't mean just the line you sent, I thought you may have a load of code and the few lines that do the range selection then the sort would be OK. You must have a line before this with range(some cells).select can you sent the whole macro, if it is small.
__________________
------------------------- Hope this is helpful. ------------------------- only a drafter, but broadening my Excel knowledge. |
|
|
|
|
|
#7 |
|
Join Date: Mar 2004
Posts: 6
|
That's the whole thing. I didn't write this code. I highlighted the cells, hit record new macro, went up to sort, then stopped recording. That is the whole thing. That is the whole thing.
|
|
|
|
|
|
#8 |
|
Join Date: Mar 2002
Posts: 292
|
YOu should hit record macro BEFORE you highlight the cells. THat way the highlighting of cells is also repeated. At the moment you are just doing the sort on a few columns and rows because only those cells are selected.
Hope this helps. |
|
|
|
|
|
#9 |
|
Join Date: Mar 2004
Posts: 6
|
It worked - for now. Hopefully it won't mess up again.
Thanks. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|