+ Reply to Thread
Results 1 to 4 of 4

Error working with Range Object in VBA

  1. #1
    Registered User
    Join Date
    07-24-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    73

    Error working with Range Object in VBA

    Apologies, this is purely amateur stuff:

    The following code works:

    Please Login or Register  to view this content.
    However, when I try to add a single cell reference to MyRange, it returns an error. For example:

    Please Login or Register  to view this content.
    What am I doing wrong, or what am I not doing?

    I've learnt a lot in the past weeks working with vba, but tiny things like this baffle me from time to time.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Error working with Range Object in VBA

    Please Login or Register  to view this content.
    I think you can only have a row and column.

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Error working with Range Object in VBA

    Far as I'm aware, you can't have more than two arguements when assigning a range. If you use Range("A1","F1"), this is the same as Range("A1:F1"), i.e. the two arguements define the opposite corners of the range. So Range("N41:N43","R41:R43") would give you Range("N41:R43"). I'm assuming you only want N41, N42, N43, R41, R42 and R43 and not the cells in between which would be:
    Please Login or Register  to view this content.
    Extending that to include T43:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-24-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    73

    Re: Error working with Range Object in VBA

    I'm always surprised when people reply to my cries for help!

    That's excellent yudlugar - works perfectly now, and I've learnt something!

+ 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. Runtime Error - Subscript out of Range / Object Error
    By JHRice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-04-2012, 05:14 PM
  2. [SOLVED] Name a dynamic range - Run-time error 1004 Method 'Range' of object'_Worksheet' failed
    By DavidBW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-03-2012, 08:00 AM
  3. 'Range' of Object Error
    By Emonk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2011, 03:34 PM
  4. Set range object not working
    By LuckyJim1001 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-16-2009, 06:47 PM
  5. [SOLVED] Range Question / error 1004: method Range of object Worksheet has failed
    By Paul in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2005, 10:06 AM

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