+ Reply to Thread
Results 1 to 3 of 3

How to input selection (i.e. multiple active cells)

  1. #1
    Registered User
    Join Date
    08-18-2016
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    3

    Smile How to input selection (i.e. multiple active cells)

    Hi guys,

    I'm brand new to VBA so this is probably extremely basic. I understand ActiveCell is used to describe a single cell, but I was wondering how to describe my entire selection. An excel VBA course told me "Selection" should work, but I get an error message saying "Ambiguous name detected ~". The code I attempted to run is below. If I input a range instead of selection the code works. Any ideas on how to generalize it for any selected cells?

    Thank you

    Sub properties()
    'Add a border to selected cells
    Selection.Borders.Value = 1
    End Sub

  2. #2
    Forum Contributor
    Join Date
    04-15-2015
    Location
    beirut
    MS-Off Ver
    2010
    Posts
    107

    Re: How to input selection (i.e. multiple active cells)

    this massage:"Ambiguous name detected"tel you that is there another macro with the same name

  3. #3
    Registered User
    Join Date
    08-18-2016
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    3

    Re: How to input selection (i.e. multiple active cells)

    But then why does this formula work when "selection" is replace with "activecell" or a range? Would the name not remain the same?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Input rows multiple times depending on selection - Database
    By erikavb04 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-30-2015, 02:23 PM
  2. ComboBox Selection Caused Cells to be copied to active worksheet
    By octalman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2015, 02:12 PM
  3. [SOLVED] Macro - Format as Table selection active cells
    By Camardelli in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-14-2013, 12:10 PM
  4. Command button to request user input (selection) of a range of cells
    By KarlGramith in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2013, 05:37 PM
  5. Input two cells with one selection
    By Keith in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2005, 11:05 AM
  6. Replies: 1
    Last Post: 03-24-2005, 03:06 PM
  7. Counting Number of Cells in Active Selection
    By Sara21 in forum Excel General
    Replies: 0
    Last Post: 01-19-2005, 12:03 PM

Tags for this Thread

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