If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Setting up a Command Button to sort
Hi Ron
one way: - record a ,acro whild doing the sort manually - assign this macro to a button -- Regards Frank Kabel Frankfurt, Germany "rg8407 " schrieb im Newsbeitrag ... i am very new with using command buttons. I have set up several to work correctly, but have unable to set up one to sort data. What I want to do is copy and paste and HTML report into my spreadsheet and then click on a Sort Command Button to sort it the way I need to view. The sort is always the same. The information for the spreadsheet is as follows: cells A2..M150 contain the data I would want the primary sort to be on column E with a secondary sort on column A if this is possible. Can someone please tell me how to program this command button to sort this way. Thanks, Ron --- Message posted from http://www.ExcelForum.com/ |
#2
|
|||
|
|||
Setting up a Command Button to sort
Hi
for your first question see: http://www.mvps.org/dmcritchie/excel/getstarted.htm To make sure you get all columns ejust select the entire columns -- Regards Frank Kabel Frankfurt, Germany Thanks Frank but I have two questions: First, I am relatively new to all this more detailed Excel work. Is this very difficult to do? Is there a book you can recommend to help me with this type of stuff? Second, can I do this so it recognized the number of rows that are there? I changed the post from the time you saw it. There will be a varying number of rows pasted into the spreadsheet, however the columns will stay the same. I need to make this as simple as possible to use because the production workers will rely on it daily. They will need to re-run it often, so the simpler for them, the better. One button to do this would be a big help. Thanks for your help, Ron --- Message posted from http://www.ExcelForum.com/ |
#3
|
|||
|
|||
Setting up a Command Button to sort
Hi Ron,
cells A2..M150 contain the data I would want the primary sort to be on column E with a secondary sort on column A I am guessing that you have a Total in Row 151 and don't want to sort that, so I took steps to include rows above the last row with content in Column A. If that is not the case then look at the macro above the one I will be pointing you to. I created a pair of Worksheet Event macros for you that might work out better for you than a command button, if there is only one sort sequence you are interested in. Event macros are triggered by an Event and are installed differently from regular macros. The Event macros that I created are for when the worksheet is activated, and a double-click macro that initiates the worksheet activate so you don't have to leave the worksheet. See Example at http://www.mvps.org/dmcritchie/excel...g.htm#activate more information on Event macros at http://www.mvps.org/dmcritchie/excel/event.htm When you sort things manually you are generally better off to select all cells on the worksheet (Ctrl+A) before going to Data, Sort... -- That way all data will go with your sorted keys. Unless you meant to sort the columns independently of anything else in which case select a column, invoke the sort, then select another column and sort it -- without any associated data in the other columns. When you copy and paste into Excel from an HTML source you will probably have CHAR(160) which in HTML is the nonbreaking space character. They may appear not to interfere with characters, but they definitely will interfere with numbers in Excel worksheets. You will probably want to use the TRIMALL macro found at http://www.mvps.org/dmcritchie/excel/join.htm#trimall Did you know that you can sort a table right in your HTML web page (or someone else's) -- one column. Unfortunately Internet Explorer is limited to the size of a bookmark that you can have in your Favorites (or Links on your IE Toolbar). But it works fine from Mozilla or if the shortcut is actually on the webpage as a link. See http://www.mvps.org/dmcritchie/ie/bo...ts.htm#sandbox If you still want a Command Button you would right click on it and assign a macro such as (this one sorts entire worksheet). http://www.mvps.org/dmcritchie/excel/sorting.htm#record We are a friendly bunch here, in the Excel newsgroups, and it's a lot more friendly and professional to use your first and last name when posting, so we know who we are talking to. If ExcelForum does not make that easy when it redirects you to newsgroups then please include your first and last name in your signature line. --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm |
Thread Tools | |
Display Modes | |
|
|