Consulting

Results 1 to 6 of 6

Thread: Investigating the selection

  1. #1

    Investigating the selection

    How do i check the number of rows, columns, etc. of a Selection-object?

  2. #2
    Also, i forgot to add - how can i force VBA to always view a list of complishions? Sometimes i get to see it after a period, sometimes i don't. How do i force it?

    On the same tune - how can i check all the properties of Selection myself ?

  3. #3
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    You can use Selection.Rows.Count and Selection.Columns.Count if the selection consists of a single block of cells. (You should also check that the selection is in fact a range)
    The Intellisense will usually pop up if it is clear what kind of object is being referred to. You can also press Ctrl+J to display them where available.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Thanks! Now, let me turn the question around. I'd like to discover when the selection (target sent into a method, actually, always being a range, not neccessarily a simple/single one) is consisted of exactly one cell. How can that be done?

  5. #5
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    Check Selection.Count to see if it equals 1.
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    Nice! Thanks!

Posting Permissions

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