Thread: functions
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Steve Steve is offline
external usenet poster
 
Posts: 1,814
Default functions

i'm sorry, they are parts of buttons. the code for each button is longer
than this, but this is one portion that is similar in both. if you could
explain this part to me, i could apply it to the rest. but to answer your
question, the user will pick a button to use, "sort by date" or "sort by
name". also, while i have your attention, what exactly does option explicit
do to the code?

thank you

"K Dales" wrote:

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