Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 08-29-2011, 03:49 AM
Catalin.B Catalin.B is offline What is the best approach? Windows Vista What is the best approach? Office 2007
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

There is something unclear:
when you say " i have 2 worksheets, one with..." you mean 2 worksheets in the same workbook,
or, more probably , you meant " 2 workbooks ", the second workbook contains 50 worksheets named with states name?
Check the samples attached, ( you need to sort worksheets after updating values), for a macro to update all worksheets, you can try this: (will sort after column C-ID number)

Sub SortAllWks()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
ws.Activate
Range("A5:E175").Select
ActiveSheet.Sort.SortFields.Clear
ActiveSheet.Sort.SortFields.Add Key:=Range("C5:C175"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ws.Sort
.SetRange Range("A4:E175")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Next ws
End Sub

All the work can be done with a macro, as an alternative..
Attached Files
File Type: zip New Folder.zip (47.9 KB, 12 views)
Reply With Quote
 



Other Forums: Access Forums

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


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