Thread: Sheet Position
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Sheet Position

Hi James,

Here's a function to determine if a sheet exists:

Public Function gbSheetExists(rsShtName As String, _
Optional rwbWorkbook As Workbook) As Boolean
On Error Resume Next
If rwbWorkbook Is Nothing Then
gbSheetExists = Len(Sheets(rsShtName).Name)
Else
gbSheetExists = Len(rwbWorkbook.Sheets(rsShtName).Name)
End If
End Function

--
Regards,

Jake Marx
www.longhead.com

James Weaver wrote:
Great - thanks.

Also, do you know how to check whether a sheet already
exists?

James
-----Original Message-----
Try
sheets("End")

"James Weaver" wrote in message
...
I know that code can be written to reference sheets
according to their position in the Workbook, e.g.:

Sheets("abc").Copy Befo=Sheets(6)

The sheet that is in position 6 is called "End" but it
moves position as you copy more sheets into the file! So,
I need some code to be able to locate the numerical
position of the "End" sheet and put the variable back into
the 'copy' code above.

Any ideas anyone?!

Thanks,
James



.