LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Why does this not work?

Hard to tell, but if you are using the Activate event, you shouldn't be
activating sheet within that event.

Sub Macro1()
ScreenUpdating = False
With Sheets("Data Base")
Range("B2:D325").Sort Key1:=.Range("C2"), _
Order1:=xlAscending, Key2:=.Range("B2"), _
Order2:=xlAscending, Key3:=.Range("D2"), _
Order3:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End With
ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy

"Pete" wrote in message
...
First the following macro works when run from with in the "Data Base"
sheet.

But when I paste this code in Private Sub Worksheet_Activate() for the
Data Base sheet I get an error 1004 on the range("b2:d325).select

Why?

Sub Macro1()

ScreenUpdating = False

Sheets("Data Base").Select

Range("B2:D325").Select

Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Key2:=Range("B2")
_
, Order2:=xlAscending, Key3:=Range("D2"), Order3:
=xlAscending, Header:= _

xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("B2").Select

Sheets("First Name").Select

ScreenUpdating = True

End Sub



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
how can i automatically generate work order numbers from work orde rob h Excel Discussion (Misc queries) 1 July 13th 09 07:59 PM
flash object dont work in my excel work sheet Nitn Excel Discussion (Misc queries) 0 July 4th 09 08:00 AM
Counting dates in multiple work sheets and work books Savage Excel Discussion (Misc queries) 0 December 19th 05 11:41 PM
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM


All times are GMT +1. The time now is 04:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"