Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-03-2010, 05:17 PM
Ziggy-R Ziggy-R is offline Macro for automatic sorting Windows XP Macro for automatic sorting Office 2003
Novice
Macro for automatic sorting
 
Join Date: Sep 2010
Posts: 13
Ziggy-R is on a distinguished road
Default

Quote:
Originally Posted by BjornS View Post
Hi,
I am more a "formula expert", but I looked around a little, stole some code and modified it

Here we go:
Right click the sheet tab. Select "View code".
Paste the code below. Modify sort column if wanted (A1 at the moment). Leave with Alt+Q.
Done!

Kind regards
Bjorn



Private Sub Worksheet_Change(ByVal Target As Range)
'Sort this sheet by column A
'Written by OzGrid Business Applications
'www.ozgrid.com
'small modification by Bjorn 2010-10-02

On Error Resume Next
Application.EnableEvents = False
Me.UsedRange.Sort _
Key1:=[A1], Order1:=xlAscending, Header:=xlYes, Orientation:=xlSortColumns
Application.EnableEvents = True
On Error GoTo 0

End Sub

No luck, man. Maybe it's because I didn't change the sort column (How do I?), but upon opening and closing, all the data remains the same.
Reply With Quote
  #2  
Old 10-04-2010, 02:07 PM
BjornS BjornS is offline Macro for automatic sorting Windows Vista Macro for automatic sorting Office 2003
Competent Performer
 
Join Date: Jan 2010
Location: Sweden
Posts: 116
BjornS is on a distinguished road
Default

Hi,
try replacing A1 with C1 in the macro, since you like to sort column C (which contains the supplier).

Kind regards
Bjorn
Reply With Quote
Reply

Tags
macro, sort



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for automatic sorting Sorting question markg2 Excel 4 01-25-2010 03:13 PM
automatic start of macro + help on writing helper function vsempoux Word 3 10-09-2009 03:01 AM
Sorting Outlook TO: field anakeimai Outlook 0 09-30-2009 06:15 AM
Sorting Tasks by Contacts Bat Outlook 0 09-24-2007 01:20 PM
sheet linking, sorting nickbfe Excel 0 05-19-2006 11:00 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:03 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2026 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft