selecting coloums problem???

Joined
Aug 18, 2005
Messages
4
Reaction score
0
i am using the following code to sort several (165) sheets by coloumn Q. the problem being i need to ignore the last row on each sheet, this row being the TOTALS row which i want to stay at the bottom of the sheet. i thought it may be possible to instead of using Cells.Select to select coloums A to U and rows 1 to THE NEXT BLANK ROW if this makes sense??? i just do not know how??? any ideas please, thank yous :o)

Sub IFASORT()
'
' IFASORT Macro
'
' Keyboard Shortcut: Ctrl+Shift+A
'
Application.ScreenUpdating = False
SRw = ActiveWindow.ScrollRow
SCol = ActiveWindow.ScrollColumn
'count the sheet and run through
For i = Sheets.Count To 1 Step -1
Sheets(i).Select
'this is the sort procedure
Cells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1").Select

'back to routine
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
Next
'return to normal state
ActiveWindow.ScrollRow = SRw
ActiveWindow.ScrollColumn = SCol
Application.ScreenUpdating = True
'show in status bar amount of sheets
Application.StatusBar = i
End Sub
 

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