View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default return to original sheet


well........ you can do it one of two ways.
one is to add
(untested syntax but theory is correct!)

dim myPage as worksheet

set myPage = activeworksheet
application.screenupdating=false

before your code, and at the end, add

myPage.select
application.screenupdating=true

this way it would do everything you want it to do, without you
seeing that it's moving around. this is untested & i've just spent
the last 10 minutes trying to get the stupid concept to work!!!!!
will keep trying in case you can't do it, either! (grrrrr!).

the other way would be to learn to eliminate the "selects" in
your code. you can't do this by recording, because the re-
corder ALWAYS "selects" things in order to work with them.
hope this helps!
susan



On Jan 24, 10:34 am, enyaw wrote:
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 23/01/2007 by GX
'

Sheets("Summary").Select
Range("A38:C51").Select
Selection.Copy
Range("E38").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.sort Key1:=Range("G38"), Order1:=xlDescending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

This is my code that is run when changes are made to a sheet. I have a
sheet for each day of the month and a summary sheet at the end of the month.
When the values are entered into to the days sheets it goes into the summary
sheet and this macro runs. The problem is i want the macro to run when the
info is entered but i also want to stay on the sheet i am on. Can anyone
help?