View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Pat Pat is offline
external usenet poster
 
Posts: 210
Default Sub Macro vrs Function Macro Auto Start

JLatham thanks for your fast response & "Your" assurance that I am not as
dumb as I think. To answer your questions. When a end user enters scores
everything is linked so the other"Team Scores Weekly" workbook is updated &
this updates the High Scores Sheet. The end user will not in most instances
open the workbook Team Scores Weekly. I do need the High Game Scores to
update Weekly as I have another report that will need the data from the High
Game Scores. 1 of my tries to make this work is:
=Personal.xls!SortScoresFile(),Personalxls!Module8 .TmSortScores (this returns
a Value Error)
I tried to make a copy of my macro to paste but could not. So I will type it:
Module8 -1
Sub Workbook_open__()
End Sub
Sub TMSORSCORES()
'
'
'TMSORTSCORES Macro
'Macro recorded 06/05/2007 by Pat
'
Range ("a11:d218").Select
Selection. Copy
Range ("f11").Select
Activesheet.paste
Application.cutcopymode = False
Selection.Sort Key1:=Range("i11"), Order 1:=xlDescending,
Key2:=Range("g11'),
Order2:=xlAscending, Header:=xlguess, OrderCustom:=1. MatchCase_:=False,
Orientation:=xlTopToBottom, DataOptionl:=xlSortNormal, _ Data
Option2:=xlSortNormal
End Sub

I hope this answered your questions. "ALL" help is appreciated.

"JLatham" wrote:

Pat, I'm a bit confused, so I need to ask you to restate the problem You
make mention of two workbooks. My question is:
*What* do you want to happen in *which workbook* when an end user enters new
scores?

The Workbook_Open() event processor is associated with an individual
workbook. Whatever code you put into it will be executed when the workbook
is opened, each time it is opened.

To have some code run each time someone makes a change to data on a
worksheet you would want to use a the Worksheet_Change() event processor. To
get into the area to use that code, right-click on the sheet's name tab and
choose [View Code] from the list.

There are 2 main differences between a Sub and a Function. A Function
(normally) returns a value and a Function (usually) can be referenced in a
formula on a worksheet by its name. A Sub doesn't have those abilities.

Also, if you publish your code here, we may be able to look at it and
determine why you're getting errors. Don't worry - we've all seen attempts
at coding by novices before (we were all a novice at one time ourselves) that
didn't quite get the job done.

"Pat" wrote:

I have data where an end user put's scores in & this is linked to a workbook
called Team # 1 scores. This updates a sheet "Team Scores Weekly which
updates another sheet in the same workbook "High Game Scores". I created a
macro to copy & sort the High Game Scores from High to Low which works fine
when I click the button. I want this automatically sort as Scores are
entered each week by end user. I changed the macro to a Function. After
reading other questions made a new macro & used the function & macro together
got a value error & excel encounterd a problem & kicked me out. I know its
me. I read about Workbook_open etc from all the other questions. I'm new so
?? Please help.