+ Reply to Thread
Results 1 to 4 of 4

Select Named Range - Active sheet - Message Box address

  1. #1
    al007
    Guest

    Select Named Range - Active sheet - Message Box address

    Am looking for a macro which would give me in message boxes all named
    range & address in my active sheet one after the other & finally select
    them - something similar as macro below.

    Sub FindMergedAreas()
    Dim d As Range, myCell As Range
    Set d = Nothing
    For Each myCell In ActiveSheet.UsedRange
    If myCell.MergeCells Then
    If d Is Nothing Then
    Set d = myCell.MergeArea
    MsgBox "First merged area is " & myCell.MergeArea.Address
    Else
    If Intersect(d, myCell.MergeArea) Is Nothing Then
    MsgBox "Another merged area is " & myCell.MergeArea.Address
    End If
    Set d = Union(d, myCell.MergeArea)
    End If
    End If
    Next myCell
    If Not d Is Nothing Then d.Select
    End Sub

    Can anybody help pls.

    Thxs


  2. #2
    Gary Keramidas
    Guest

    Re: Select Named Range - Active sheet - Message Box address

    not sure if this is what you wanted or not.

    Option Explicit

    Sub name_ranges4() ' dumps all named ranges
    Dim nm As Name
    For Each nm In ThisWorkbook.Names
    MsgBox nm.Name & " " & Range(nm).Address
    Next nm
    End Sub

    --


    Gary


    "al007" <[email protected]> wrote in message
    news:[email protected]...
    > Am looking for a macro which would give me in message boxes all named
    > range & address in my active sheet one after the other & finally select
    > them - something similar as macro below.
    >
    > Sub FindMergedAreas()
    > Dim d As Range, myCell As Range
    > Set d = Nothing
    > For Each myCell In ActiveSheet.UsedRange
    > If myCell.MergeCells Then
    > If d Is Nothing Then
    > Set d = myCell.MergeArea
    > MsgBox "First merged area is " & myCell.MergeArea.Address
    > Else
    > If Intersect(d, myCell.MergeArea) Is Nothing Then
    > MsgBox "Another merged area is " & myCell.MergeArea.Address
    > End If
    > Set d = Union(d, myCell.MergeArea)
    > End If
    > End If
    > Next myCell
    > If Not d Is Nothing Then d.Select
    > End Sub
    >
    > Can anybody help pls.
    >
    > Thxs
    >




  3. #3
    al007
    Guest

    Re: Select Named Range - Active sheet - Message Box address

    Thxs nearly just what I want - I want to end the macro with all name
    ranged selected - what else do I need to add
    Thxs


  4. #4
    al007
    Guest

    Re: Select Named Range - Active sheet - Message Box address

    It doesn't work if there's name in multiple sheet


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1