+ Reply to Thread
Results 1 to 4 of 4

Thread: Return Range Address from Active Range

  1. #1
    ExcelMonkey
    Guest

    Return Range Address from Active Range

    I know that I can return the address from the Active Cell by looking at the
    Address property of the object:

    ActiveCell.Address

    How do I do this if the object is a range that is hightlighted?
    ActiveRange.Address does not seem to work. There does not seem to be an
    object called ActiveRange

    Thanks



  2. #2
    Norman Jones
    Guest

    Re: Return Range Address from Active Range

    Hi Monkey.

    Try:

    Selection.Address

    ---
    Regards,
    Norman



    "ExcelMonkey" <ExcelMonkey@discussions.microsoft.com> wrote in message
    news:2AED0E33-90BD-4654-ACC8-9A31A883728D@microsoft.com...
    >I know that I can return the address from the Active Cell by looking at the
    > Address property of the object:
    >
    > ActiveCell.Address
    >
    > How do I do this if the object is a range that is hightlighted?
    > ActiveRange.Address does not seem to work. There does not seem to be an
    > object called ActiveRange
    >
    > Thanks
    >
    >




  3. #3
    ExcelMonkey
    Guest

    Re: Return Range Address from Active Range

    How do I then wrap a function around Selection. I am trying to tell if the
    Selection contains more than 1 cell. However when I try to pass the
    Selection as a Range to the function I get a Type Mismatch Error

    Sub CopyFormula()
    Dim X As New DataObject
    If SingleCell(Selection) = False Then
    MsgBox ("Your range can only include 1 cell!")
    Else
    X.SetText ActiveCell.Formula
    X.PutInClipboard
    End If
    End Sub
    '**********************************************
    Function SingleCell(X As Range)
    If X.Rows > 1 Or X.Columns > 1 Then
    SingleCell = False
    Else
    SingleCell = True
    End If
    End Function


    Thanks

    "Norman Jones" wrote:

    > Hi Monkey.
    >
    > Try:
    >
    > Selection.Address
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "ExcelMonkey" <ExcelMonkey@discussions.microsoft.com> wrote in message
    > news:2AED0E33-90BD-4654-ACC8-9A31A883728D@microsoft.com...
    > >I know that I can return the address from the Active Cell by looking at the
    > > Address property of the object:
    > >
    > > ActiveCell.Address
    > >
    > > How do I do this if the object is a range that is hightlighted?
    > > ActiveRange.Address does not seem to work. There does not seem to be an
    > > object called ActiveRange
    > >
    > > Thanks
    > >
    > >

    >
    >
    >


  4. #4
    Norman Jones
    Guest

    Re: Return Range Address from Active Range

    Hi Monkey,

    Drop the function and try:

    If Selection.Count > 1 Then
    Msgbox "Your range can only include 1 cell!"
    Else
    'Your code
    End If


    --
    Regards,
    Norman



    "ExcelMonkey" <ExcelMonkey@discussions.microsoft.com> wrote in message
    news:72D75E04-3E2D-43D4-897E-C2940010DF4E@microsoft.com...
    > How do I then wrap a function around Selection. I am trying to tell if
    > the
    > Selection contains more than 1 cell. However when I try to pass the
    > Selection as a Range to the function I get a Type Mismatch Error
    >
    > Sub CopyFormula()
    > Dim X As New DataObject
    > If SingleCell(Selection) = False Then
    > MsgBox ("Your range can only include 1 cell!")
    > Else
    > X.SetText ActiveCell.Formula
    > X.PutInClipboard
    > End If
    > End Sub
    > '**********************************************
    > Function SingleCell(X As Range)
    > If X.Rows > 1 Or X.Columns > 1 Then
    > SingleCell = False
    > Else
    > SingleCell = True
    > End If
    > End Function
    >
    >
    > Thanks
    >
    > "Norman Jones" wrote:
    >
    >> Hi Monkey.
    >>
    >> Try:
    >>
    >> Selection.Address
    >>
    >> ---
    >> Regards,
    >> Norman
    >>
    >>
    >>
    >> "ExcelMonkey" <ExcelMonkey@discussions.microsoft.com> wrote in message
    >> news:2AED0E33-90BD-4654-ACC8-9A31A883728D@microsoft.com...
    >> >I know that I can return the address from the Active Cell by looking at
    >> >the
    >> > Address property of the object:
    >> >
    >> > ActiveCell.Address
    >> >
    >> > How do I do this if the object is a range that is hightlighted?
    >> > ActiveRange.Address does not seem to work. There does not seem to be
    >> > an
    >> > object called ActiveRange
    >> >
    >> > Thanks
    >> >
    >> >

    >>
    >>
    >>




+ 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.2.0