Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
issue copying data
Hello,
I have a macro as follows : ' Range("A45:A57").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=bt*", Operator:=xlAnd Range("A48:I56").Select Windows("Odd workbook.xls").Activate Selection.Copy Workbooks.Open Filename:= _ "C:\Documents and Settings\Customers" Sheets("BT").Select Range("A3").Select ActiveSheet.Paste Range("M3:N3").Select Windows("Odd workbook.xls").Activate Application.CutCopyMode = False Selection.AutoFilter Range("N45:o57").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=bt*", Operator:=xlAnd Range("N46:w56").Select Selection.Copy Windows("Customers.xls").Activate Range("M3:N3").Select *** ActiveSheet.Paste Range("A3").Select *** Windows("Odd workbook.xls").Activate Application.CutCopyMode = False Selection.AutoFilter Range("A53").Select End Sub My problem is that as a macro this works fine and I get the data transferred properly, however when I try and copy this code to a command button it starts to go wrong and I get error messages and when I debug the lines I have typed the 4* are highlighted in yellow and I don't understand why. I tried to delete these and all that happened was that the first data got overwritten by the second, any help please? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
issue copying data
Whenever dealing with more than one sheet in Excel,
you should qualify all range callouts with the sheet name... Worksheets("Customers.xls").Range("M3:N3") -- Jim Cone Portland, Oregon USA "Sj" wrote in message ... Hello, I have a macro as follows : ' Range("A45:A57").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=bt*", Operator:=xlAnd Range("A48:I56").Select Windows("Odd workbook.xls").Activate Selection.Copy Workbooks.Open Filename:= _ "C:\Documents and Settings\Customers" Sheets("BT").Select Range("A3").Select ActiveSheet.Paste Range("M3:N3").Select Windows("Odd workbook.xls").Activate Application.CutCopyMode = False Selection.AutoFilter Range("N45:o57").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=bt*", Operator:=xlAnd Range("N46:w56").Select Selection.Copy Windows("Customers.xls").Activate Range("M3:N3").Select *** ActiveSheet.Paste Range("A3").Select *** Windows("Odd workbook.xls").Activate Application.CutCopyMode = False Selection.AutoFilter Range("A53").Select End Sub My problem is that as a macro this works fine and I get the data transferred properly, however when I try and copy this code to a command button it starts to go wrong and I get error messages and when I debug the lines I have typed the 4* are highlighted in yellow and I don't understand why. I tried to delete these and all that happened was that the first data got overwritten by the second, any help please? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Color formatting issue when copying excel sheet from workbook to o | Excel Discussion (Misc queries) | |||
Data Validation Issue? | Excel Discussion (Misc queries) | |||
Chart Copying Issue | Charts and Charting in Excel | |||
Data validation issue | Excel Worksheet Functions | |||
Issue with copying Text. | Excel Discussion (Misc queries) |