+ Reply to Thread
Results 1 to 11 of 11

Invalid or unqualified reference on range select

Hybrid View

  1. #1
    Registered User
    Join Date
    10-05-2010
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    23

    Invalid or unqualified reference on range select

    Can anyone see where this simple as macro went wrong?

    Sub Macro1()
    
    ActiveWorkbook.Range(.Cells(12, (2 * 3)), .Cells(14, (2 * 3))).Activate
    End Sub

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Invalid or unqualified reference on range select

    dots in front of .Cells

    they would be needed in case of

    With someobject
      your instruction
    end with
    Best Regards,

    Kaper

  3. #3
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Invalid or unqualified reference on range select

    Hi

    What do you want to do?


    not use .Cells, correct
    Cells
    and what?
    (2 * 3)
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Invalid or unqualified reference on range select

    Quote Originally Posted by marreco View Post
    (2 * 3)
    This does not hurt. but unqualified dots - as I said - do.

  5. #5
    Registered User
    Join Date
    10-05-2010
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    23

    Re: Invalid or unqualified reference on range select

    Thanks for the comments guys. I tried two options which neither worked:

    Sub Macro1()
    
    With ActiveWorkbook
    .Range(.Cells(12, (2 * 3)), .Cells(14, (2 * 3))).Activate
    End With
        
    End Sub
    and then this which gave me an 'objcet doesn't supported property or method:

    Sub Macro1()
    
    ActiveWorkbook.Range(Cells(12, (2 * 3)), Cells(14, (2 * 3))).Activate
        
    End Sub

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

    Re: Invalid or unqualified reference on range select

    A workbook doesn't have a Cells property.

    Which worksheet are the cells you want to select on?
    If posting code please use code tags, see here.

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

    Re: Invalid or unqualified reference on range select

    A workbook doesn't have a Cells property.

    Which worksheet are the cells you want to select on?

  8. #8
    Registered User
    Join Date
    10-05-2010
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    23

    Re: Invalid or unqualified reference on range select

    They are on the active worksheet.

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

    Re: Invalid or unqualified reference on range select

    Try this.
        With ActiveWorkbook.ActiveSheet
            .Range(.Cells(12, (2 * 3)), .Cells(14, (2 * 3))).Activate
        End With

  10. #10
    Registered User
    Join Date
    10-05-2010
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    23

    Re: Invalid or unqualified reference on range select

    Almost! I would like to select two cells but not the one inbetween that I would like to see not selected.

  11. #11
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Invalid or unqualified reference on range select

    Try:
        With ActiveWorkbook.ActiveSheet
            Union(.Cells(12, (2 * 3)), .Cells(14, (2 * 3))).Activate
        End With
    PS. Where were my eyes, that I've not noticed that no sheet was specified few posts up :-(

+ 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. [SOLVED] Getting error invalid or unqualified reference
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-20-2014, 08:15 PM
  2. [SOLVED] Getting error invalid or unqualified reference
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-23-2014, 11:31 PM
  3. [SOLVED] Invalid or unqualified reference
    By michelle 1 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-22-2013, 08:11 AM
  4. Invalid or Unqualified Reference
    By dcompagnone in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-13-2010, 08:45 AM
  5. [SOLVED] Another invalid or unqualified reference
    By davegb in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 08-31-2005, 02:05 PM

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