Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default try to use a worksheet object

I must be missing a concept here

Why does this not work

Dim FY As Strin
Dim chartsheet as workshee

Set ChartSheet = Sheets("PORChart"

FY = ChartSheet.txtF

When this does work

Dim FY As Strin

FY = Sheets("PORChart").txtF

Call code is executed form a separate code module

Any explanation would be great

Thank

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default try to use a worksheet object

The Sheets collection contains 2 kinds of distinct objects: Worksheets and
Charts (or "Chart Sheets": don't confuse Chart Sheets with Chart objects
that can also exist on Worksheets.).

Example 1 doesn't work because you defined your object variable explicitly
as a worksheet and then tried to assign (what I assume is) a Chart sheet to
it. A pure and simple Type Mismatch.

Your 2nd example works because it avoids the Worksheet vs.Chart sheet issue
and simply points to a member of the Sheets collection.

--

HTH,
George Nicholson

Remove 'Junk' from return address.


"DataDude" wrote in message
...
I must be missing a concept here.

Why does this not work:

Dim FY As String
Dim chartsheet as worksheet

Set ChartSheet = Sheets("PORChart")

FY = ChartSheet.txtFY

When this does work:

Dim FY As String

FY = Sheets("PORChart").txtFY


Call code is executed form a separate code module.

Any explanation would be great.

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default try to use a worksheet object

Actually

"ChartSheet" is just what I happend to call that worksheet (obviouslly a poor choice in names). "Chartsheet" is in fact a worksheet with cells. No chart

So I'm still a little confused.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default try to use a worksheet object

? sheet3.MyVar
$B$3
? worksheets("Sheet3").Myvar
$B$3
set sh = Worksheets("Sheet3")
? sh.Myvar
$B$3

all worked for me.

--
Regards,
Tom Ogilvy




"DataDude" wrote in message
...
I must be missing a concept here.

Why does this not work:

Dim FY As String
Dim chartsheet as worksheet

Set ChartSheet = Sheets("PORChart")

FY = ChartSheet.txtFY

When this does work:

Dim FY As String

FY = Sheets("PORChart").txtFY


Call code is executed form a separate code module.

Any explanation would be great.

Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Create New Worksheet and Reference Cell in Old Worksheet As Tab Name - "Object Required" Error [email protected] Excel Discussion (Misc queries) 4 September 25th 06 01:35 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Charts and Charting in Excel 3 August 24th 06 07:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Excel Discussion (Misc queries) 2 August 24th 06 05:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Excel Worksheet Functions 2 August 24th 06 05:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet jeftiong New Users to Excel 0 August 23rd 06 01:50 PM


All times are GMT +1. The time now is 04:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"