Which Worksheet is Active?

B

Bishop

If I'm working in VBE and I need to know what the active Workbook is or which
Worksheet is active, how do I figure that out? Is there some tool that will
tell me this?
 
K

ker_01

msgbox activeworkbook.name
msgbox activesheet.name
(or, activeworkbook.activesheet.name)

HTH,
Keith
 
F

FSt1

hi
Sub whatisit()
Dim awbn As String
Dim awsn As String
awbn = ActiveWorkbook.Name
awsn = ActiveSheet.Name
MsgBox awbn
MsgBox awsn
End Sub

regards
FSt1
 
B

Bishop

This is perfect. How do I add a shortcut key to this? Say I wanted to use
ctrl+q to run this?
 
F

FSt1

hi
install the macro in a standard module then on the menu bar....
Tools>macro>macros
highlight the macro then click the options button. add your shortcut then ok
out.

Regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top