Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have some VBA code (see below) where I am copying a fixed selection from
one workbook (which the user has selected), into the next empty row in a different workbook (where the macro is located). Sheets("National").Select Range("A6:X21").Select Selection.Copy Windows("Diagnostics 2010-2011.xls").Activate Sheets("C-National").Select Selection.paste However, I get a run time error (438) on the paste command when I try to run it. Any suggestions, as I am new to VBA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try the below which will copy the range from the Activeworkbook Sheet
National to openworkbook Diagnostics Sheet c-national... Sub Macro() Dim wb As Workbook Set wb = Workbooks("Diagnostics 2010-2011.xls") Sheets("National").Range("A6:X21").Copy _ wb.Sheets("C-National").Range("A1") End Sub -- Jacob "BoRed79" wrote: I have some VBA code (see below) where I am copying a fixed selection from one workbook (which the user has selected), into the next empty row in a different workbook (where the macro is located). Sheets("National").Select Range("A6:X21").Select Selection.Copy Windows("Diagnostics 2010-2011.xls").Activate Sheets("C-National").Select Selection.paste However, I get a run time error (438) on the paste command when I try to run it. Any suggestions, as I am new to VBA |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To Activecell
Sub Macro() Dim wb As Workbook Set wb = Workbooks("Diagnostics 2010-2011.xls") Sheets("National").Range("A6:X21").Copy _ wb.Sheets("C-National").ActiveCell End Sub -- Jacob "BoRed79" wrote: I have some VBA code (see below) where I am copying a fixed selection from one workbook (which the user has selected), into the next empty row in a different workbook (where the macro is located). Sheets("National").Select Range("A6:X21").Select Selection.Copy Windows("Diagnostics 2010-2011.xls").Activate Sheets("C-National").Select Selection.paste However, I get a run time error (438) on the paste command when I try to run it. Any suggestions, as I am new to VBA |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Try this Sheets("National").Range("A6:X21").Copy _ Destination:=Workbooks("Diagnostics 2010-2011.xlsx").Sheets("C-National").Range("A1") -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "BoRed79" wrote: I have some VBA code (see below) where I am copying a fixed selection from one workbook (which the user has selected), into the next empty row in a different workbook (where the macro is located). Sheets("National").Select Range("A6:X21").Select Selection.Copy Windows("Diagnostics 2010-2011.xls").Activate Sheets("C-National").Select Selection.paste However, I get a run time error (438) on the paste command when I try to run it. Any suggestions, as I am new to VBA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pasting active links in excel | Excel Discussion (Misc queries) | |||
Macro for pasting on active column | Excel Programming | |||
Deselecting active cells after pasting | Excel Programming | |||
pasting textbox value to active cell | Excel Discussion (Misc queries) | |||
Opening and pasting in active workbook | Excel Programming |