Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime error 1004
PLease help!
This has been racking my brains for days! I am trying to select a cell from which to start a selection copy. however i keep getting the runtime error on the Range line where, o where am i going wrong?!?!?!? Private Sub CommandButton1_Click() OrderNumber = InputBox("Enter CPL#") If OrderNumber = "" Then End If Receiptfile = "CPL #" & OrderNumber & ".xls" Workbooks.Open Filename:="C:\Documents and Settings\a\My Documents\" & Receiptfile ActiveSheet.Name = Receiptfile Workbooks.Open Filename:= _ "C:\Documents and Settings\a\My Documents\Entry Build.xls" Windows("Entry Build.xls").Activate Sheets("Entry Build").Select Sheets("Entry Build").Copy After:=Workbooks(Receiptfile).Sheets(1) Sheets(Receiptfile).Activate Range("A12").Activate THIS IS THE CULPRIT LINE OF CODE!!! Range(Selection, Selection.End(xlToRight)).Select Range("A12:I350").Select Application.CutCopyMode = False Selection.Copy Sheets("Entry Build").Select ActiveWindow.SmallScroll Down:=-3 Range("A5").Select ActiveSheet.Paste |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime error 1004
Private Sub CommandButton1_Click()
OrderNumber = InputBox("Enter CPL#") If OrderNumber = "" Then exit sub End If Receiptfile = "CPL #" & OrderNumber & ".xls" set bk1 = Workbooks.Open( Filename:= _ "C:\Documents and Settings\a\My Documents\" & Receiptfile ActiveSheet.Name = Receiptfile set bk2 = Workbooks.Open Filename:= _ "C:\Documents and Settings\a\My Documents\Entry Build.xls" bk2.Sheets("Entry Build").Copy After:=bk1.Sheets(1) With bk1.Sheets(Receiptfile) .Range("A12:I350").Copy bk1.Sheets("Entry Build").Range("A5") End With End Sub -- Regards, Tom Ogilvy " wrote: PLease help! This has been racking my brains for days! I am trying to select a cell from which to start a selection copy. however i keep getting the runtime error on the Range line where, o where am i going wrong?!?!?!? Private Sub CommandButton1_Click() OrderNumber = InputBox("Enter CPL#") If OrderNumber = "" Then End If Receiptfile = "CPL #" & OrderNumber & ".xls" Workbooks.Open Filename:="C:\Documents and Settings\a\My Documents\" & Receiptfile ActiveSheet.Name = Receiptfile Workbooks.Open Filename:= _ "C:\Documents and Settings\a\My Documents\Entry Build.xls" Windows("Entry Build.xls").Activate Sheets("Entry Build").Select Sheets("Entry Build").Copy After:=Workbooks(Receiptfile).Sheets(1) Sheets(Receiptfile).Activate Range("A12").Activate THIS IS THE CULPRIT LINE OF CODE!!! Range(Selection, Selection.End(xlToRight)).Select Range("A12:I350").Select Application.CutCopyMode = False Selection.Copy Sheets("Entry Build").Select ActiveWindow.SmallScroll Down:=-3 Range("A5").Select ActiveSheet.Paste |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime error 1004
Cleaned up a couple of typos:
Private Sub CommandButton1_Click() Dim bk1 As Workbook, bk2 As Workbook OrderNumber = InputBox("Enter CPL#") If OrderNumber = "" Then Exit Sub End If Receiptfile = "CPL #" & OrderNumber & ".xls" Set bk1 = Workbooks.Open(Filename:= _ "C:\Documents and Settings\a\My Documents\" & _ Receiptfile) ActiveSheet.Name = Receiptfile Set bk2 = Workbooks.Open(Filename:= _ "C:\Documents and Settings\a\My Documents" & _ "\Entry Build.xls") bk2.Sheets("Entry Build").Copy _ After:=bk1.Sheets(1) With bk1.Sheets(Receiptfile) .Range("A12:I350").Copy bk1.Sheets( _ "Entry Build").Range("A5") End With End Sub -- Regards, Tom Ogilvy "Tom Ogilvy" wrote: Private Sub CommandButton1_Click() OrderNumber = InputBox("Enter CPL#") If OrderNumber = "" Then exit sub End If Receiptfile = "CPL #" & OrderNumber & ".xls" set bk1 = Workbooks.Open( Filename:= _ "C:\Documents and Settings\a\My Documents\" & Receiptfile ActiveSheet.Name = Receiptfile set bk2 = Workbooks.Open Filename:= _ "C:\Documents and Settings\a\My Documents\Entry Build.xls" bk2.Sheets("Entry Build").Copy After:=bk1.Sheets(1) With bk1.Sheets(Receiptfile) .Range("A12:I350").Copy bk1.Sheets("Entry Build").Range("A5") End With End Sub -- Regards, Tom Ogilvy " wrote: PLease help! This has been racking my brains for days! I am trying to select a cell from which to start a selection copy. however i keep getting the runtime error on the Range line where, o where am i going wrong?!?!?!? Private Sub CommandButton1_Click() OrderNumber = InputBox("Enter CPL#") If OrderNumber = "" Then End If Receiptfile = "CPL #" & OrderNumber & ".xls" Workbooks.Open Filename:="C:\Documents and Settings\a\My Documents\" & Receiptfile ActiveSheet.Name = Receiptfile Workbooks.Open Filename:= _ "C:\Documents and Settings\a\My Documents\Entry Build.xls" Windows("Entry Build.xls").Activate Sheets("Entry Build").Select Sheets("Entry Build").Copy After:=Workbooks(Receiptfile).Sheets(1) Sheets(Receiptfile).Activate Range("A12").Activate THIS IS THE CULPRIT LINE OF CODE!!! Range(Selection, Selection.End(xlToRight)).Select Range("A12:I350").Select Application.CutCopyMode = False Selection.Copy Sheets("Entry Build").Select ActiveWindow.SmallScroll Down:=-3 Range("A5").Select ActiveSheet.Paste |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Runtime error 1004 | Excel Programming | |||
Uh oh...Runtime error 1004!!!! | Excel Programming | |||
runtime error 1004 | Excel Discussion (Misc queries) | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
What is RunTime Error '1004'? | Excel Programming |