Articles | Photoshop blog | Photography blog | about me | e-mail

Helen Bradley - MS Office Tips, Tricks and Tutorials

I'm a lifestyle journalist and I've been writing about office productivity software for a long time. Here you'll find handy hints, tips, tricks, techniques and tutorials on using software as diverse as Excel, Word, PowerPoint, Outlook, Access and Publisher from Microsoft and other applications that I love. My publishing credits include PC Magazine, Windows XP mag, CNet, PC User mag, SmallbusinessComputing.com, Winplanet and Sydney Morning Herald.

Tuesday, February 2, 2010

Excel VBA: What Sheet is that?

When you’re working in Microsoft Excel Visual Basic for Applications, you may need to refer to a worksheet by name. This can be confusing because the sheet names are not necessarily what are displayed in the sheet tabs at the bottom of the screen.

There is only one way to know exactly what a sheet’s name is so you can refer to it by that name regardless of what the tab says. That is to view the Visual Basic Editor and select your project in the Project Explorer. Here you will see each sheet listed by name with the sheet tab name in brackets after it.

If you want to refer to a sheet by name in your VBA code use the sheet name at the left (not the one in brackets) in the Project Explorer.

This will ensure that you always use the exact sheet that you expect to be using in your Visual Basic application.

Labels: , ,

Add to Technorati Favorites