Subscript is out of Range

T

teresa

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
 
F

Frank Kabel

Hi
sounds like this worksheet is not opened. Maybe the space after 'wip' is not
in the workbook name?
 
T

Tom Ogilvy

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.
 

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