PPRuNe Forums - View Single Post - Any VBA aces here?
View Single Post
Old 4th November 2009 | 11:14
  #2 (permalink)  
Sprogget
 
Joined: Mar 2006
Posts: 495
Likes: 0
From: Chez Sprog
Ah, getting somewhere. I recorded a macro, giving me this code:
Code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 04/11/2009 by Sproggett
'
' Keyboard Shortcut: Ctrl+s
'
   Range("A6:V408").Select
   Selection.Sort Key1:=Range("H6"), Order1:=xlAscending, Key2:=Range("K6") _
        , Order2:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
       Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
       xlSortNormal End Sub
The end range I have higlighted is now causing me a problem. If I add a row to the sheet to record a new sale, it only sorts up to row 408. So my new question is how do I ensure the macro continues to include new rows as the spreadsheet expands?
Sprogget is offline  
Reply