Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Referencing sheets/objects


Hi,

I am new to writing macros for excel and have a problem I need some
help with:

I want to add a chart using data from the active sheet. I tried the
code below. I know it's writing the active sheet name to CSheet
because I can read it using msgbox so why won't the reference work??

CSheet = ActiveSheet.Name
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData
Source:=Sheets("CSheet").Range("C16:D82"), PlotBy _
:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:="CSheet"
etc..


--
dve11
------------------------------------------------------------------------
dve11's Profile: http://www.excelforum.com/member.php...o&userid=31618
View this thread: http://www.excelforum.com/showthread...hreadid=513129

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Referencing sheets/objects

Hi DVE11,

Change:

Name:="CSheet"
to
Name:=CSheet


---
Regards,
Norman



"dve11" wrote in message
...

Hi,

I am new to writing macros for excel and have a problem I need some
help with:

I want to add a chart using data from the active sheet. I tried the
code below. I know it's writing the active sheet name to CSheet
because I can read it using msgbox so why won't the reference work??

CSheet = ActiveSheet.Name
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData
Source:=Sheets("CSheet").Range("C16:D82"), PlotBy _
:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:="CSheet"
etc..


--
dve11
------------------------------------------------------------------------
dve11's Profile:
http://www.excelforum.com/member.php...o&userid=31618
View this thread: http://www.excelforum.com/showthread...hreadid=513129



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
Referencing between two Excel Workbook Objects Stephen Schroeder Excel Worksheet Functions 0 July 16th 07 02:08 AM
cannot shift objects off sheets Bob Phillips Excel Worksheet Functions 1 March 6th 06 09:26 PM
COM Addin for Excel: Despite referencing the Excel Object Library no objects availabl Newmoon Excel Programming 0 August 30th 05 03:58 PM
MS Dialog 5.0 sheets - Accessing data elements of objects Malriem Excel Worksheet Functions 2 June 4th 05 04:46 PM
Preventing compile errors when referencing objects ehanced after 1997 Matt Somers Excel Programming 6 February 13th 04 10:25 PM


All times are GMT +1. The time now is 01:26 PM.

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

About Us

"It's about Microsoft Excel"