1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: messagebox calling contents of a named range

Discussion in 'Business Applications' started by roninn75, Jul 17, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. roninn75

    roninn75 Thread Starter

    Joined:
    Feb 19, 2012
    Messages:
    38
    good day

    i wish on doubleclick to have a message box appear with the contents of a named range inside it.
    HTML:
    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
     
  2. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    5,946
    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?
     
  3. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    5,946
    Something like this?

    Double Click E10
     

    Attached Files:

  4. roninn75

    roninn75 Thread Starter

    Joined:
    Feb 19, 2012
    Messages:
    38
    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
     
  5. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    5,946
    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?
     
  6. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    5,946
    Editted it a little bit, a sheet module and an external module
     

    Attached Files:

  7. roninn75

    roninn75 Thread Starter

    Joined:
    Feb 19, 2012
    Messages:
    38
    As always, Brilliant! thanks Hans. I'll mark this post as solved.
     
  8. Sponsor

As Seen On
As Seen On...

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.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1061401