+ Reply to Thread
Results 1 to 4 of 4

Selecting all cells. Cells.Select is not working

  1. #1
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Selecting all cells. Cells.Select is not working

    This line only works when the 1st sheet is the active sheet. It doesn't work when the others are active.

    Cells.Select


    When the 3rd worksheet is selected, this isn't working on the 1st sheet:

    Worksheets(1).Cells.Select


    And to further complicate matters, these things do not ALWAYS work or fail. I'm not sure how to explain this. Any ideas?

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Selecting all cells. Cells.Select is not working

    cells.select will only work if the code is the sheet module of the active worksheet. If its in the workbook module you'll need activesheet.cells.select. To complicate further you can't select cells on a sheet that is not the active sheet.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Selecting all cells. Cells.Select is not working

    One can Select Cells ONLY on the Active Sheet. However, one rarely needs to Select...what is it you're trying to do?
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,228

    Re: Selecting all cells. Cells.Select is not working

    Yep,
    It looks like you'll need to do a 2 statement code of:
    Please Login or Register  to view this content.
    to get what I think you want.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

+ 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. Selecting all cells. Cells.Select is not working
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2013, 04:04 PM
  2. [SOLVED] Using code to select cells that are two cells to the left of the currently active cell
    By LaffyAffy13 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-25-2013, 01:56 PM
  3. Replies: 4
    Last Post: 01-31-2012, 01:08 PM
  4. macro to select cells based on status of cells to left
    By dcbiker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2011, 05:15 PM
  5. this formula for selecting cells isnt working
    By twofootgiant in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2008, 03:29 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