Thread: functions
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default functions

You can actually combine the code as a new sub - but what I would need to
know is how the user will interact with the sheet to determine which
variation of the code is to run - how do you intend for them to choose which
column to sort by? Do you want to use the selected cell to determine the
sort column? Or prompt them in some way and use their response to choose?
Or activate from a control, such as a button or listbox? That makes a big
difference in how the code will be written.
--
- K Dales


"steve" wrote:

from the little bit of programming i have taken, i know you can combine
similar codes using functions. can someone help me with these sets of code i
have?

Sub SortProjectName()

ActiveSheet.Cells.ClearOutline
Range("A6:T1112").Sort Key1:=Range("Q7"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub

Sub SortDateRec()

ActiveSheet.Cells.ClearOutline
Range("A6:T1112").Sort Key1:=Range("T7"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub