Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can a workbook variable be set by clicking the workbook?


If so, how? If not, any suggestions?

Many thanks,

Adria

--
Kobayash
-----------------------------------------------------------------------
Kobayashi's Profile: http://www.excelforum.com/member.php...info&userid=87
View this thread: http://www.excelforum.com/showthread.php?threadid=27331

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Can a workbook variable be set by clicking the workbook?

Option Explicit
Sub testme()
Dim myRng As Range
Dim wkbk As Workbook

On Error Resume Next
Set myRng = Application.InputBox(prompt:="Click on a cell", Type:=8)
On Error GoTo 0

If myRng Is Nothing Then
Exit Sub
End If

MsgBox myRng.Parent.Name 'worksheet
MsgBox myRng.Parent.Parent.Name 'workbook

'so...
Set wkbk = myRng.Parent.Parent
'....

End Sub



Kobayashi wrote:

If so, how? If not, any suggestions?

Many thanks,

Adrian

--
Kobayashi
------------------------------------------------------------------------
Kobayashi's Profile: http://www.excelforum.com/member.php...nfo&userid=871
View this thread: http://www.excelforum.com/showthread...hreadid=273314


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Can a workbook variable be set by clicking the workbook?

I think it would be better to explain what you are trying to achieve, we
might be able to help then.

--

HTH

RP

"Kobayashi" wrote in message
...

If so, how? If not, any suggestions?

Many thanks,

Adrian


--
Kobayashi
------------------------------------------------------------------------
Kobayashi's Profile:

http://www.excelforum.com/member.php...nfo&userid=871
View this thread: http://www.excelforum.com/showthread...hreadid=273314



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not set WorkBook variable jlclyde Excel Discussion (Misc queries) 5 March 6th 08 09:46 PM
Double Clicking on link w/i workbook does't bring me to souce. tfranc Excel Worksheet Functions 2 July 19th 06 01:16 PM
Prevent Excel closing all workbook instances when clicking on "X" Deeptech-NM Excel Discussion (Misc queries) 8 July 4th 05 01:36 PM
Workbook name as variable to another workbook Nigel Excel Discussion (Misc queries) 1 May 17th 05 02:26 PM
workbook as variable pete Excel Programming 2 January 25th 04 09:20 PM


All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"