Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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" wrote in message ups.com... 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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" wrote in message oups.com... 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Its so simple! Why won't it work!
Thanks Chip, I'll work that method into my next project. That makes
sense though. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
So simple, but I can't get it to work | Excel Discussion (Misc queries) | |||
simple deletion won't work for me | Excel Discussion (Misc queries) | |||
Simple but I can't get it to work? PLEASE help!! | Excel Discussion (Misc queries) | |||
Why does this simple thing not work? | Excel Programming | |||
Why this simple macro doesn't work? | Excel Programming |