+ Reply to Thread
Results 1 to 5 of 5

Its so simple! Why won't it work!

  1. #1
    Kevin O'Neill
    Guest

    Its so simple! Why won't it work!

    I'm going mad. I've tried so many different ways. I've even had it
    work, save the project, come back 30 min. later, and then doesn't work.

    No changes made.


    All I'm trying to do is Select a cell from another sheet.


    I'd prefer to select the sheet using: Sheet12 ; rather than it's name:
    Loads & I have to use Cells()


    Tried these and more...
    Worksheets("Loads").Cells(8, 41).Select
    Sheet12.Cells(8, 41).Select


    "Select Method of Range Class Failed" - error
    I assume that has something to do with the '.select'


  2. #2
    Chip Pearson
    Guest

    Re: Its so simple! Why won't it work!

    You can't select cells on a sheet that is not the active sheet.
    You have to select the sheet first, then the cells. E.g.,

    Worksheets("Loads").Select
    Cells(8,14).Select

    Of course, it is rarely necessary to use Select in the first
    place, so if you post what you are ultimately trying to do,
    someone may have an idea how to accomplish it without having to
    select a range.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com




    "Kevin O'Neill" <[email protected]> wrote in message
    news:[email protected]...
    > I'm going mad. I've tried so many different ways. I've even had
    > it
    > work, save the project, come back 30 min. later, and then
    > doesn't work.
    >
    > No changes made.
    >
    >
    > All I'm trying to do is Select a cell from another sheet.
    >
    >
    > I'd prefer to select the sheet using: Sheet12 ; rather than
    > it's name:
    > Loads & I have to use Cells()
    >
    >
    > Tried these and more...
    > Worksheets("Loads").Cells(8, 41).Select
    > Sheet12.Cells(8, 41).Select
    >
    >
    > "Select Method of Range Class Failed" - error
    > I assume that has something to do with the '.select'
    >




  3. #3
    Kevin O'Neill
    Guest

    Re: Its so simple! Why won't it work!

    Chip thanks. Worked like a charm. I'm not a programmer by trade, my
    Boss always tells me there's no need to 'select' things, but I always
    do it anyway. I don't know any better.


  4. #4
    Chip Pearson
    Guest

    Re: Its so simple! Why won't it work!

    I'm glad it works. You rarely need to Select a range, and doing
    so is a very slow operation. Instead of Selecting, you can use a
    Range variable Set to the appropriate range, and use that
    variable. For example, instead of


    Range("A1").Select
    Selection.Font.Bold = True

    you could use

    Range("A1").Font.Bold = True
    or
    Dim Rng As Range
    Set Rng = Range("A1")
    Rng.Font.Bold = True

    Because Selection can be any type of object in addition to a
    range (a Shape, a Chart, etc), a lot of code must execute behind
    the scenes to determine what type of object Selection actually
    is.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "Kevin O'Neill" <[email protected]> wrote in message
    news:[email protected]...
    > Chip thanks. Worked like a charm. I'm not a programmer by
    > trade, my
    > Boss always tells me there's no need to 'select' things, but I
    > always
    > do it anyway. I don't know any better.
    >




  5. #5
    Kevin O'Neill
    Guest

    Re: Its so simple! Why won't it work!

    Thanks Chip, I'll work that method into my next project. That makes
    sense though.


+ 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