View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Define worksheet as variable, then call in macro

Hi Bugman,

Try something like:

'==========
Public Sub One()
Dim SH As Worksheet

With ActiveWorkbook
Set SH = .Worksheets(.Worksheets.Count)
End With

Call Two(SH)

End Sub

'------------

Public Sub Two(aSheet As Worksheet)

MsgBox aSheet.Name

End Sub
'<<==========

---
Regards,
Norman


"bugman" wrote in
message ...

Hello All,

I want to dim a worksheet name, and then later call it as a variable to
go to in another macro.

e.g.

Dim callworksheetname as worksheets
callworksheetname = bob

Call bobsaddress()
Activate.bob.worksheet

I know the above is wrong, but you can guess what i am getting at

Any help please?

J


--
bugman
------------------------------------------------------------------------
bugman's Profile:
http://www.excelforum.com/member.php...o&userid=28999
View this thread: http://www.excelforum.com/showthread...hreadid=487283