Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Solved: messagebox calling contents of a named range


(!)

roninn75's Avatar
roninn75 roninn75 is offline
Member with 36 posts.
THREAD STARTER
 
Join Date: Feb 2012
17-Jul-2012, 07:13 AM #1
Solved: messagebox calling contents of a named range
good day

i wish on doubleclick to have a message box appear with the contents of a named range inside it.
HTML Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim ws As Worksheets, sRange As Range
If Target.Count > 1 Then Exit Sub
If Target.Address = "$E$10" Then
     ws = Sheet2
     sRange = ws("Ranges").Range("PROVCODEDESC").Value
       'Display legend for this cell
        MsgBox "Legend is:" & sRange"
End If
Cancel = True
End Sub
 
so far this code however gives me an object variable not set error... and then it still has to call the actual contents of the named range. any assistance would be appreciated

Last edited by roninn75; 17-Jul-2012 at 07:45 AM..
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,432 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
17-Jul-2012, 08:07 AM #2
Hi there,
Well, I'm back too, not in full stride yet but...
Do you need to see the that values fo the range?
STN_WEST
STN_EAST
STN_NORTH if you call up the stations range?
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,432 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
17-Jul-2012, 08:28 AM #3
Something like this?

Double Click E10
Attached Files
File Type: xlsm RangeInMsgBox.xlsm (16.3 KB, 30 views)
roninn75's Avatar
roninn75 roninn75 is offline
Member with 36 posts.
THREAD STARTER
 
Join Date: Feb 2012
17-Jul-2012, 08:41 AM #4
hi Hans
glad to hear
thank you for that, but its for a different project. the "PROVCODEDESC" is a named range on sheet2 that i am calling from sheet1
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,432 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
17-Jul-2012, 09:19 AM #5
I thohght that mmuch but it was just as a reference.
You need a msgbox that shows the contents of a range in another hsset, correct?
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,432 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
17-Jul-2012, 09:24 AM #6
Editted it a little bit, a sheet module and an external module
Attached Files
File Type: xlsm RangeInMsgBox.xlsm (18.7 KB, 26 views)
roninn75's Avatar
roninn75 roninn75 is offline
Member with 36 posts.
THREAD STARTER
 
Join Date: Feb 2012
17-Jul-2012, 11:09 AM #7
As always, Brilliant! thanks Hans. I'll mark this post as solved.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑