Hi,
I was wondering if there is a way to auto sort columns in a document.
Thanks in advance!
Hi,
I was wondering if there is a way to auto sort columns in a document.
Thanks in advance!
Turn on the macro recorder, let it record you highlighting all the data to sort, then turn off the recorder.
Now open the VBEditor (Atl-F11) and open the MODULE that was created (left pane) that now has your macro in it.
Copy all the code between the Sub / End Sub.
Doubleclick on the SHEET module (left pane) where you want this to work all the time and the sheet module will open.
At the top of the module enter the following header:
Now, anytime you make a change of any kind to your sheet, the data will autosort. If that doesn't work, post up your final code and we'll help you "tweak" it.![]()
Please Login or Register to view this content.
When you post code, be sure to GO ADVANCED, past the code into the forum, highlight it, then click on the # icon to wrap it on code tags so that it is readable.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
Thanks for the info, i'll try it tonight.
Quick question though, where exactly do I turn on the Macro Recorder?
Thanks!
Tools > Macros > Record a new macro
In Excel, pressing F1 will popup the built-in help menu.
This is what I have! The first part, at top, is for my pivot tables! Any ideas?
Thanks
![]()
Please Login or Register to view this content.
Last edited by THORmx; 04-27-2009 at 06:27 AM.
anyone? Please help![]()
I don't see your question....just an "any ideas" query. That's not as helpful as you would think.
True. You asked me to "paste" my final code if it needed tweaking. Well, I posted it as it's not working, and I'm getting a debugging error...
I kind of have this working now, however I'm having a few hiccups. It seems that it will automate before I completely finish typing. The document has 2 columns of data that need to move together. Basically, column A has a name, and B is data that supports it. I need them to both move.
The automate works great except for 1 hitch......as soon as I type something into Column A and hit enter, it auto sorts. I need to type data into column B too and hit enter, before it decides to automate. Once that happens, it'll be PERFECT!!
Thanks again JBeaucaire for the help so far, it's appreciated!!
Last edited by THORmx; 05-23-2009 at 07:10 AM.
Just to save time, can you post the sheet you're working on so I can tweak it directly?
GO ADVANCED > paperclip icon.
Thanks.
Here JB.
It's a list of DVD's. Thanks for your time!
You just need the worksheet code to evaluate BOTH cells before it actually moves anything, so I added like so:
![]()
Please Login or Register to view this content.
Thanks JB, seems to work great! One last thing to ask...is it possible to have it re order when I delete something out of the 2 cells? Like lets say I have "taken" in A5, and "DVD" in B5, and I delete them. Anyway to re sort when I delete things?
Thanks again so much!
OK, try this:
![]()
Please Login or Register to view this content.
Seems to work like a CHARM JB. Thanks so much. Sorry for not responding earlier, my laptop crashed!!
Thanks again
Glad to hear it! If that takes care of your need, be sure to EDIT your original post (Go Advanced) and [SOLVED] to the beginning of the thread title.
(Also, use the "scales" icon in our posts to leave Feedback, it is appreciated)
Will do, thanks again! Now, to figure it out, because it will not let me edit the first post...
Last edited by THORmx; 05-31-2009 at 03:17 AM.
Just GO ADVANCED and manually add [SOLVED] to the start of the thread title. The prefix box disappears after only a few days.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks