Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

seting a changing range to sort on 3 different sheets

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jhyatt - 18 Sep 2007 15:34 GMT
I have been working on this for a while with no luck.  I have a list in 3
different sheets for different departments.  I am using a userform to enter
the new data and i need some way to set the new range to sort when new data
is added.  i need to sort using column b and d.

for example
  a     b     c      d        e    f
1    Charlie    7-27-07       sick
2    Zach       8-21-07       late
3    charlie    1-30-07       off
4    Steve      9-02-07      late
pablo bellissimo - 18 Sep 2007 16:20 GMT
If your userform is adding the new data in the first available row beneath
the existing data could you just add the following at the end of the code you
are using to add the data to each worksheet?

Range("A2").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("B2"), Key2:=Range("D2")

?? does this help?

> I have been working on this for a while with no luck.  I have a list in 3
> different sheets for different departments.  I am using a userform to enter
[quoted text clipped - 7 lines]
> 3    charlie    1-30-07       off
> 4    Steve      9-02-07      late
jhyatt - 18 Sep 2007 16:40 GMT
the code you gave does not sort to the existing list this is what i have but
when a different department (that goes on a different sheet) is selected it
does not work.

if you want to look at the entire code i can post.

Dim NumCount As Long
       NumCount = Cells(Rows.Count, "b").End(xlUp).Row
       Range("b5:f" & NumCount).sort Key1:=Range("b5"), key2:=Range("d5")

> If your userform is adding the new data in the first available row beneath
> the existing data could you just add the following at the end of the code you
[quoted text clipped - 17 lines]
> > 3    charlie    1-30-07       off
> > 4    Steve      9-02-07      late
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.