Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to return to original cell | Excel Discussion (Misc queries) | |||
return to original sheet | Excel Programming | |||
Return to Original Workbook | Excel Programming | |||
Return WB to original state | Excel Programming | |||
Return to Original File | Excel Programming |