LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Refer to Worksheet Ranges in Code

I have been reading the following item:-

http://msdn.microsoft.com/library/de...heetranges.asp

and it uses the following code:-

Dim ws As Excel.Worksheet = _
DirectCast(ThisWorkbook.Worksheets(1), Excel.Worksheet)
Dim rng, rng1, rng2 As Excel.Range

but when I try and use it, the first two lines show up in red in the VBA
editor.

Is there a reason for this? I am using Excel 2000, is there an add-in or
something I need to use the "DirectCast"?

Basically I am after a few pointers on how to refer to worksheet ranges from
code but am getting stuck.

Thanks

Andi


 
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
How to refer to a cell format code? A difficult problem Excel Discussion (Misc queries) 1 May 25th 05 08:42 AM
Formula to refer to other worksheet... Liz-In-USA Excel Worksheet Functions 4 November 9th 04 10:51 PM
More then 1 Excel object running at same time , how can I refer to right one in code? Dave Lauberts Excel Programming 5 October 28th 04 03:57 PM
refer to the sheets Name property in my code (not what is on the Tab) Sandy[_5_] Excel Programming 3 January 29th 04 08:45 PM
XL 2000: automating drag-and-drop for worksheet ranges. Using Code! Dan P Excel Programming 3 September 3rd 03 03:36 AM


All times are GMT +1. The time now is 12:01 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"