Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 354
Default Set RN = Range(Cells(2, 1), Cells(r, 1)) error

What wrong with this. It create error. How can I improve to get rid the
error?

Set RN = Range(Cells(2, 1), Cells(r, 1))

Thanks
Daniel
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,344
Default Set RN = Range(Cells(2, 1), Cells(r, 1)) error

Hi Daniel,

Too much missing information - has r been declared and what data type is it
and what value does it have. What property of the range are you trying to
store in the variable RN? What type of variable is RN and has it been
declared.
--
Thanks,
Shane Devenshire


"Daniel" wrote:

What wrong with this. It create error. How can I improve to get rid the
error?

Set RN = Range(Cells(2, 1), Cells(r, 1))

Thanks
Daniel

  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Set RN = Range(Cells(2, 1), Cells(r, 1)) error

Make sure variables are declared and defined, and make sure you reference
potentially indeterminate ranges.

Dim RN As Range
Dim wks As Worksheet
Dim r As Long

Set wks = ActiveWorkbook.Worksheets("My Sheet")
r = 100

Set RN = wks.Range(wks.Cells(2,1), wks.Cells(r, 1))

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______



"Daniel" wrote in message
...
What wrong with this. It create error. How can I improve to get rid the
error?

Set RN = Range(Cells(2, 1), Cells(r, 1))

Thanks
Daniel



  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,344
Default Set RN = Range(Cells(2, 1), Cells(r, 1)) error

Hi,

The reason Jon and I are pointing these issues out is that your single line
of code is fine. The reason it fails is something else is wrong and Jon and
I can't see your code so we are just suggesting the most likely places.

Fact is, code that fails on a particular line can fail despite the fact that
the line is correct.
--
Thanks,
Shane Devenshire


"Jon Peltier" wrote:

Make sure variables are declared and defined, and make sure you reference
potentially indeterminate ranges.

Dim RN As Range
Dim wks As Worksheet
Dim r As Long

Set wks = ActiveWorkbook.Worksheets("My Sheet")
r = 100

Set RN = wks.Range(wks.Cells(2,1), wks.Cells(r, 1))

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______



"Daniel" wrote in message
...
What wrong with this. It create error. How can I improve to get rid the
error?

Set RN = Range(Cells(2, 1), Cells(r, 1))

Thanks
Daniel




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
how to compute a range of cells based on another range of cells? HAROLD Excel Worksheet Functions 1 December 30th 05 09:32 PM
how to compute a range of cells based on another range of cells? HAROLD Excel Worksheet Functions 2 December 30th 05 07:55 PM
How to use macros to copy a range of cells which can exclude some cells which I didn't want to be copied? excelnovice Excel Worksheet Functions 2 September 25th 05 12:38 AM
How do you sum a range of more than 30 cells. I get error each time I try. Joseph Conaghan via OfficeKB.com Excel Worksheet Functions 5 March 21st 05 10:15 PM
sum a range of cells that include an error HeatherC Excel Discussion (Misc queries) 2 January 28th 05 10:58 AM


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