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

Stop selecting the other worksheet.

Option Explicit
Sub Macro2()

with workSheets("Summary")
.Range("A38:C51").Copy
.Range("E38").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

.range("g38").currentregion.sort Key1:=.Range("G38"), _
Order1:=xlDescending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
end with
End Sub

I sorted .currentregion. I'm not sure if that's what you wanted.

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?


--

Dave Peterson