Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default return to original sheet

yes, dave's example is much better, and it's good to learn
to do it that way, as i have.
but if you want to do it the other way temporarily, the problem
i had was that it is activesheet, not activeworksheet.
susan


On Jan 24, 11:17 am, Dave Peterson wrote:
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- Hide quoted text -- Show quoted text -


Reply
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 return to original cell Tonso Excel Discussion (Misc queries) 1 April 1st 10 02:48 AM
return to original sheet Susan Excel Programming 0 January 24th 07 04:16 PM
Return to Original Workbook ajvasel Excel Programming 12 August 10th 06 03:32 AM
Return WB to original state Ronbo Excel Programming 3 January 13th 06 11:47 AM
Return to Original File Stephen[_11_] Excel Programming 2 April 22nd 04 12:24 PM


All times are GMT +1. The time now is 01:11 PM.

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

About Us

"It's about Microsoft Excel"