ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Subscript is out of Range (https://www.excelbanter.com/excel-programming/319266-subscript-out-range.html)

Teresa

Subscript is out of Range
 
Hi,

Below is an extract from a macro, why do I get 'Subscript is out of range',
many thanks

Sub yy()

Dim curWkbk As Workbook

Set curWkbk = Workbooks("wip " & Format(Date, "dd-mm-yy") & ".xls")

End Sub


Frank Kabel

Subscript is out of Range
 
Hi
sounds like this worksheet is not opened. Maybe the space after 'wip' is not
in the workbook name?

--
Regards
Frank Kabel
Frankfurt, Germany

teresa wrote:
Hi,

Below is an extract from a macro, why do I get 'Subscript is out of
range', many thanks

Sub yy()

Dim curWkbk As Workbook

Set curWkbk = Workbooks("wip " & Format(Date, "dd-mm-yy") & ".xls")

End Sub




Tom Ogilvy

Subscript is out of Range
 
In you previous post, you said you wanted to compare the current workbook
against the most recent workbook. Dave is making an assumption that the
current workbook is named after the current date:

? "wip " & Format(Date, "dd-mm-yy") & ".xls"
wip 19-12-04.xls

If you don't have a workbook open with that name, then you would get an
error.

--
Regards,
Tom Ogilvy


"teresa" wrote in message
...
Hi,

Below is an extract from a macro, why do I get 'Subscript is out of

range',
many thanks

Sub yy()

Dim curWkbk As Workbook

Set curWkbk = Workbooks("wip " & Format(Date, "dd-mm-yy") & ".xls")

End Sub





All times are GMT +1. The time now is 06:50 AM.

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