LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default How to reference worksheet name with spaces?

I've read that single quotes are supposed to allow you to reference
worksheet names with spaces:

'Year 2004_0'

But I'm using automation (from Access) and it's not working:

sn = 'Year 2004_0'

lr = xlapp.Workbooks(strXlsFile).Worksheets(sn) _
.Range("A1").SpecialCells(xlCellTypeLastCell).Row

This returns "Error Number 9: Subscript out of range"
(works fine if no spaces in worksheet name)

I've also tried:

['Year 2004_0']

but no luck.

How can I reference a worksheet name with spaces when using automation?

Thanks in advance.


 
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
Deleting unwanted lead spaces throughout a worksheet Coles2020 Excel Worksheet Functions 12 September 21st 07 10:40 PM
remove spaces in linked worksheet object dg Excel Worksheet Functions 4 August 29th 07 04:46 PM
how do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM
Macro that double spaces rows for an entire worksheet? glaves123 Excel Discussion (Misc queries) 1 November 6th 05 03:42 AM
I want in one worksheet to relatively link to/reference cells in another without changing the format of the current worksheet. [email protected] Excel Discussion (Misc queries) 0 September 22nd 05 04:39 PM


All times are GMT +1. The time now is 10:21 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"