LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Chabnging macros to functions

I have the following macro to sort a range of cells :-
Range("A2:J5").Select
Range("J2").Activate
Selection.Sort Key1:=Range("J2"), Key2:=Range("I2"), Key3:=Range("G2"),
Order1:=xlDescending, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

That works fine when attahced to a button, bit I wanted it to work
automatically when I update a second sheet that drives formulas on the
original sheet.
I'm using the "Private Sub worksheet_Calculate()" event to drive it, but
using the same code as above gives me a Range selection error.
Anyone any ideas how to get round this?
 
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
How do I combine MACROS and functions? Mr_Crowe New Users to Excel 1 July 9th 08 02:23 AM
macros with functions Robert Excel Worksheet Functions 3 March 21st 08 02:00 PM
excel functions in macros Leopoldine Excel Programming 3 March 21st 05 03:37 PM
VBA, Macros, functions, or formulas Miss A[_2_] Excel Programming 3 August 10th 04 09:28 PM
Macros and IF Functions Keri[_2_] Excel Programming 1 April 20th 04 04:50 PM


All times are GMT +1. The time now is 03:50 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"