Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime error 1004 Oldjay Excel Programming 5 June 1st 06 11:15 PM
Uh oh...Runtime error 1004!!!! zenahs[_7_] Excel Programming 0 March 20th 06 05:16 PM
runtime error 1004 valdesd Excel Discussion (Misc queries) 2 October 12th 05 03:20 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
What is RunTime Error '1004'? Ed Excel Programming 3 November 18th 04 07:09 PM


All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"