ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro help (https://www.excelbanter.com/excel-programming/311424-macro-help.html)

Jerie

macro help
 
I have this macro as follows

Sub Copy_ESM_Prices()
'
' Keyboard Shortcut: Ctrl+t
'
Sheets("Dump").Select
Application.Goto Reference:="R1C1"
ActiveSheet.Paste
Application.Goto Reference:="ClippedGrid"
ActiveWindow.LargeScroll Down:=0
ActiveWindow.ScrollRow = 1
Selection.Sort Key1:=Range("B3"), Order1:=xlAscending,
Key2:=Range("B3") _
, Order2:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
ActiveWindow.SmallScroll ToRight:=1
ActiveWindow.LargeScroll ToRight:=-1

Sheets("TAB1").Select
Application.Goto Reference:="R1C1"
Range("Pricesv3.xls!ClippedGrid").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Range("A2:A3"), CopyToRange:=Range
("B2"), Unique:=False
Sheets("TAB2").Select
Application.Goto Reference:="R1C1"
Range("Pricesv3.xls!ClippedGrid").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Range("A2:A3"), CopyToRange:=Range
("B2"), Unique:=False
Sheets("TAB3").Select
Application.Goto Reference:="R1C1"
Range("Pricesv3.xls!ClippedGrid").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Range("A2:A3"), CopyToRange:=Range
("B2"), Unique:=False
Sheets("Dump").Select
End Sub

When I remove the section from :- sheets("tab1").select -:
down to :- sheets("dump").select (as per example)
The macro does not work.

Sub Copy_ESM_Prices()

'
' Keyboard Shortcut: Ctrl+t

'
Sheets("Dump").Select

Application.Goto Reference:="R1C1"

ActiveSheet.Paste

Application.Goto Reference:="ClippedGrid"

ActiveWindow.LargeScroll Down:=0

ActiveWindow.ScrollRow = 1

Selection.Sort Key1:=Range("B3"), Order1:=xlAscending,
Key2:=Range("B3") _

, Order2:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:= _

False, Orientation:=xlTopToBottom

ActiveWindow.SmallScroll ToRight:=1

ActiveWindow.LargeScroll ToRight:=-1

Sheets("Dump").Select

End Sub

Can any body help me please.

your help will be very much appreciated

Thank You

Rgs Jerie


Bob Phillips[_6_]

macro help
 
What is it supposed to do and what doesn't happen?

--

HTH

RP

"Jerie" wrote in message
...
I have this macro as follows

Sub Copy_ESM_Prices()
'
' Keyboard Shortcut: Ctrl+t
'
Sheets("Dump").Select
Application.Goto Reference:="R1C1"
ActiveSheet.Paste
Application.Goto Reference:="ClippedGrid"
ActiveWindow.LargeScroll Down:=0
ActiveWindow.ScrollRow = 1
Selection.Sort Key1:=Range("B3"), Order1:=xlAscending,
Key2:=Range("B3") _
, Order2:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
ActiveWindow.SmallScroll ToRight:=1
ActiveWindow.LargeScroll ToRight:=-1

Sheets("TAB1").Select
Application.Goto Reference:="R1C1"
Range("Pricesv3.xls!ClippedGrid").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Range("A2:A3"), CopyToRange:=Range
("B2"), Unique:=False
Sheets("TAB2").Select
Application.Goto Reference:="R1C1"
Range("Pricesv3.xls!ClippedGrid").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Range("A2:A3"), CopyToRange:=Range
("B2"), Unique:=False
Sheets("TAB3").Select
Application.Goto Reference:="R1C1"
Range("Pricesv3.xls!ClippedGrid").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Range("A2:A3"), CopyToRange:=Range
("B2"), Unique:=False
Sheets("Dump").Select
End Sub

When I remove the section from :- sheets("tab1").select -:
down to :- sheets("dump").select (as per example)
The macro does not work.

Sub Copy_ESM_Prices()

'
' Keyboard Shortcut: Ctrl+t

'
Sheets("Dump").Select

Application.Goto Reference:="R1C1"

ActiveSheet.Paste

Application.Goto Reference:="ClippedGrid"

ActiveWindow.LargeScroll Down:=0

ActiveWindow.ScrollRow = 1

Selection.Sort Key1:=Range("B3"), Order1:=xlAscending,
Key2:=Range("B3") _

, Order2:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:= _

False, Orientation:=xlTopToBottom

ActiveWindow.SmallScroll ToRight:=1

ActiveWindow.LargeScroll ToRight:=-1

Sheets("Dump").Select

End Sub

Can any body help me please.

your help will be very much appreciated

Thank You

Rgs Jerie




Nick Hodge

macro help
 
Jerie

What error are you getting, what line does it fail on?

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Jerie" wrote in message
...
I have this macro as follows

Sub Copy_ESM_Prices()
'
' Keyboard Shortcut: Ctrl+t
'
Sheets("Dump").Select
Application.Goto Reference:="R1C1"
ActiveSheet.Paste
Application.Goto Reference:="ClippedGrid"
ActiveWindow.LargeScroll Down:=0
ActiveWindow.ScrollRow = 1
Selection.Sort Key1:=Range("B3"), Order1:=xlAscending,
Key2:=Range("B3") _
, Order2:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
ActiveWindow.SmallScroll ToRight:=1
ActiveWindow.LargeScroll ToRight:=-1

Sheets("TAB1").Select
Application.Goto Reference:="R1C1"
Range("Pricesv3.xls!ClippedGrid").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Range("A2:A3"), CopyToRange:=Range
("B2"), Unique:=False
Sheets("TAB2").Select
Application.Goto Reference:="R1C1"
Range("Pricesv3.xls!ClippedGrid").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Range("A2:A3"), CopyToRange:=Range
("B2"), Unique:=False
Sheets("TAB3").Select
Application.Goto Reference:="R1C1"
Range("Pricesv3.xls!ClippedGrid").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Range("A2:A3"), CopyToRange:=Range
("B2"), Unique:=False
Sheets("Dump").Select
End Sub

When I remove the section from :- sheets("tab1").select -:
down to :- sheets("dump").select (as per example)
The macro does not work.

Sub Copy_ESM_Prices()

'
' Keyboard Shortcut: Ctrl+t

'
Sheets("Dump").Select

Application.Goto Reference:="R1C1"

ActiveSheet.Paste

Application.Goto Reference:="ClippedGrid"

ActiveWindow.LargeScroll Down:=0

ActiveWindow.ScrollRow = 1

Selection.Sort Key1:=Range("B3"), Order1:=xlAscending,
Key2:=Range("B3") _

, Order2:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:= _

False, Orientation:=xlTopToBottom

ActiveWindow.SmallScroll ToRight:=1

ActiveWindow.LargeScroll ToRight:=-1

Sheets("Dump").Select

End Sub

Can any body help me please.

your help will be very much appreciated

Thank You

Rgs Jerie





All times are GMT +1. The time now is 06:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com