+ Reply to Thread
Results 1 to 5 of 5

simple range selection query

  1. #1
    Registered User
    Join Date
    11-24-2006
    Location
    Bristol, UK
    Posts
    34

    simple range selection query

    Hi guys

    I've some code running, and it keeps getting to a point and falling down. The crucial bit is:

    Please Login or Register  to view this content.
    It selects the sheet fine, but then errors on the Range. I just don't get it, this seems like really basic level VBA, but it just errors! If you can enlighten me on why, I'd be very grateful.

    (BTW - the range needs to be specified as cells, as it will be part of a loop with the row/column numbers changing.)

    Many thanks!

    Nick

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    It works ok for me selecting n4 to n46

    You may need to add .address to your cell command

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    11-24-2006
    Location
    Bristol, UK
    Posts
    34
    The .address clinches it! Once again you've helped me out Mudraker, really appreciate it.

    Can you think as to why it's necessary? I've never used it before.

    Many thanks

    Nick

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Why sometimes it works without specifying .Address and other times it needs .Address I can not give a 100% answer

    I do beleive it is has to do with the fact that if you do not specify what information you want from the command then VBA default setting is to use the cells value.

    I now always specify .Address just to be on the safe side

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646
    The problem is probably the unreferenced Cells.
    Please Login or Register  to view this content.
    Note you probably don't actually need to select in the first place.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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