ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Run-time Error '9' (https://www.excelbanter.com/excel-discussion-misc-queries/137513-run-time-error-9-a.html)

mbing916

Run-time Error '9'
 
Run-time Error '9': Subscript out of range

This error keeps appearing when I try to set up the print function command
button. I have used the same exact code on other worksheets in the same
workbook (I just changed the worksheet name) and have not had any problems.
The first line of the code is highlighted when I debug.

Private Sub CommandButton1_Click()
Sheets("Application").PageSetup.PrintArea =
Sheets("Application").Range("$a$1:$j$39").Address
Sheets("Application").PrintOut Copies:=1
End Sub


Bob Phillips

Run-time Error '9'
 
Maybe you don't have a sheet called Application. Check that it doesn't have
leading/trailing space(s).

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"mbing916" wrote in message
...
Run-time Error '9': Subscript out of range

This error keeps appearing when I try to set up the print function command
button. I have used the same exact code on other worksheets in the same
workbook (I just changed the worksheet name) and have not had any
problems.
The first line of the code is highlighted when I debug.

Private Sub CommandButton1_Click()
Sheets("Application").PageSetup.PrintArea =
Sheets("Application").Range("$a$1:$j$39").Address
Sheets("Application").PrintOut Copies:=1
End Sub





All times are GMT +1. The time now is 03:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com