Help debugging a macro!

B

BARGAIN BIN

Why do I get a run-time error '1004':
Select method of range class failed

The highlighted line is what it hangs on

Private Sub CommandButton1_Click()
'
' printNsave Macro
' Macro recorded 9/8/2004 by Owner
'

'
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Owner\My Documents\BARGAIN BIN FILES\DAILY REPORTS\test\MyName" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Range("F4:F30").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\Owner\My Documents\BARGAIN BIN FILES\DAILY REPORTS\test\DAILY REPORT.xls"
Range("E4:E30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub





Thanks
Leonard
 
N

N10

HI

try

"C:\Documents and Settings\Owner\My Documents\BARGAIN BIN FILES\DAILY REPORTS\test\DAILY REPORT.xls"
Windows("DAILY REPORT.xls").Activate
ALSO TRY ACTIVATING the appropriate sheet if you have more than sheet in the dailyreport file
Range("E4:E30").Select

:)

N10

Why do I get a run-time error '1004':
Select method of range class failed

The highlighted line is what it hangs on

Private Sub CommandButton1_Click()
'
' printNsave Macro
' Macro recorded 9/8/2004 by Owner
'

'
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Owner\My Documents\BARGAIN BIN FILES\DAILY REPORTS\test\MyName" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Range("F4:F30").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\Owner\My Documents\BARGAIN BIN FILES\DAILY REPORTS\test\DAILY REPORT.xls"
Range("E4:E30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub





Thanks
Leonard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top