Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Input Box - I think???

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a worksheet with several columns of data.
    I have a macro that sorts the data by a field name (Cost).
    It works very well.
    However, sometimes I need to sort the same sheet by a different field name, like Date Orderd.
    Instead of having 2 or 3 different Macros, is there a way to modify my current Macro and have it ask me what field name to sort the worksheet by?
    A co-worker said he thought it could be done with an Input Box.

  2. #2
    New Member
    Join Date
    Apr 2002
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    This is what the macro looks like now.
    It is very simple:

    Sub SortData2()
    '
    ' SortData2 Macro
    ' Macro recorded 4/28/2002 by Jerry Russell
    '

    '
    Range("A8:G27").Select
    Selection.Sort Key1:=Range("A8"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    Range("A1").Select
    End Sub

    Thanks for any help.

    Jerry

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Georgia USA
    Posts
    569
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try this and see if it helps
    Sub SortData2()
    '
    ' SortData2 Macro
    ' Macro recorded 4/28/2002 by Jerry Russell
    '

    Range("A8:G27").Select
    Selection.Application.Dialogs(xlDialogSort).Show
    Range("A1").Select
    End Sub

  4. #4
    New Member
    Join Date
    Apr 2002
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    This does work.
    It prompts me with the Sort Dialoge Box and then finishes the Macro.

    I did get it to work a different way but I was having problems with validation.

    I posted a new question to see if anyone had any ideas.

    Can you help on that one too?

    Please check it out.

    Thanks,

    If the data validation question is not solved, I will use your solution!

    Jerry

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    Georgia USA
    Posts
    569
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I thought that you would only have to pick the name of the column header from the list, validation would not be an issue, because only the column headers would be available to pick from and you would not have to type anything in, there by avoiding any possible mistakes

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •