Thread: [Solved] Sorting Challenge
View Single Post
 
Old 06-22-2012, 07:58 AM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

Hi Gary,

Well done for getting it to work!

Right, so the name of the worksheet is Data, the codename of the worksheet is Sheet6 and the position of the worksheet in the workbook is 1 (ie. it is the first worksheet).

In your VBA code, there are 3 ways you can get a reference to a worksheet:
1. Using its codename
2. Using Worksheets(WorksheetName)
3. Using Worksheets(WorksheetIndex)

So, in your code you can get a reference to the sheet by using
Code:
With Sheet6           'Using its codename
or
Code:
With Worksheets("Data")        'Using Worksheets(WorksheetName)
or
Code:
With Worksheets(1)          'Using Worksheets(WorksheetIndex)


You've used Option (1) which is great.
Reply With Quote