+ Reply to Thread
Results 1 to 5 of 5

Type Range incompatible for Address

  1. #1
    Registered User
    Join Date
    12-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    24

    Type Range incompatible for Address

    Bonjour,
    I am trying to capture into a variable then address of an adjacent cell currently being modified.

    The macro actually works when cell are being modified but capturing the address into a range variable leads to an incompatible type error.

    Please Login or Register  to view this content.
    When using only the MsgBox, the correct cell is displayed but when the Set rng = is active (not commented) I get the incompatible type error message.

    Thanks
    Attached Files Attached Files
    Last edited by Warluck; 10-05-2016 at 10:56 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Type Range incompatible for Address

    The Address property is a String, not a range and you only use Set with objects.

    Try declaring rng as String and changing Set rng =... to rng = ...
    If posting code please use code tags, see here.

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Type Range incompatible for Address

    Set means you are setting an Object. A string (the .Address part) is not an object. Use:
    Please Login or Register  to view this content.
    You used Call properly but I usually do this:
    Please Login or Register  to view this content.
    If your ManageCopyButton needs a range object, then that will work. If it needs a string then rng.Address(External:=True) probably needs to be sent.

  4. #4
    Registered User
    Join Date
    12-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Type Range incompatible for Address

    Thanks Norie, it works now but leaves me confused as to why it is a String and not a Range!

  5. #5
    Registered User
    Join Date
    12-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Type Range incompatible for Address

    Quote Originally Posted by Kenneth Hobson View Post
    Set means you are setting an Object. A string (the .Address part) is not an object. Use:
    Please Login or Register  to view this content.
    You used Call properly but I usually do this:
    Please Login or Register  to view this content.
    If your ManageCopyButton needs a range object, then that will work. If it needs a string then rng.Address(External:=True) probably needs to be sent.
    Thanks Kenneth, that gives me some explanation. Will do some reading to make sure I understand correctly the concept.

+ 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. Address:= .hyperlinks(1).Address subscript out of range
    By esc952 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-12-2016, 02:16 AM
  2. Match and corresp with multiple criteria - Incompatible type
    By alcalina in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2015, 03:53 PM
  3. [SOLVED] Use address of named range to find same address in another worksheet
    By dwsteyl in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-08-2013, 04:56 PM
  4. [SOLVED] Variable Type For A Residential Address
    By Limitedtimeonearth in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-02-2013, 12:12 PM
  5. Incompatible type, erreur N°13
    By Gogia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2012, 07:35 PM
  6. [SOLVED] Incompatible "allow users to edit range" in earlier Excel versions
    By PKnott in forum Excel General
    Replies: 1
    Last Post: 06-16-2006, 08:30 PM
  7. Type mismatch using rnge as Range with Type 8 Input Box
    By STEVE BELL in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-03-2005, 01:10 AM

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