Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Oct 2002
    Location
    Sheffield, Yorkshire, England
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Range Reference Types (2003 SP2)

    I am using the ref edit control on a user form. Is there an easy way of determining the range reference type that is returned i.e. a single cell, a range of cells, complete columns of cells or complete rows of cells?

    TIA
    Graham

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Range Reference Types (2003 SP2)

    You can use code similar to this:

    Dim rng As Range
    Set rng = Range(Me.RefEdit1.Value)
    If rng.Count = 1 Then
    MsgBox "Single cell"
    ElseIf rng.EntireColumn.Address = rng.Address Then
    MsgBox "Entire column(s)"
    ElseIf rng.EntireRow.Address = rng.Address Then
    MsgBox "Entire row(s)"
    Else
    MsgBox "Multiple cells"
    End If

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Range Reference Types (2003 SP2)

    ElseIf rng.Areas.Count>1 Then ...........
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Range Reference Types (2003 SP2)

    Good suggestion.

Posting Permissions

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