ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What am I missing here? (https://www.excelbanter.com/excel-programming/363825-what-am-i-missing-here.html)

Nick Smith[_2_]

What am I missing here?
 
Using the following code

Dim RngDate As Range
Set RngDate = ThisWorkbook.Worksheets("Summary Report").Range("A" & i)
ThisWorkbook.Worksheets("Summary Report").Range(RngDate).Select

Fails at line 3 with the following error:

Application Defined or object defined error.

Can anyone help me please?

Thanks.

Nick

Dave Peterson

What am I missing here?
 
RngDate is already a range--you don't need to, er, you can't wrap it inside
range().

application.goto rngdate, scroll:=true 'false?

should be sufficient.


Nick Smith wrote:

Using the following code

Dim RngDate As Range
Set RngDate = ThisWorkbook.Worksheets("Summary Report").Range("A" & i)
ThisWorkbook.Worksheets("Summary Report").Range(RngDate).Select

Fails at line 3 with the following error:

Application Defined or object defined error.

Can anyone help me please?

Thanks.

Nick


--

Dave Peterson

Gary''s Student

What am I missing here?
 
RngDate.Select
should work
--
Gary''s Student


"Nick Smith" wrote:

Using the following code

Dim RngDate As Range
Set RngDate = ThisWorkbook.Worksheets("Summary Report").Range("A" & i)
ThisWorkbook.Worksheets("Summary Report").Range(RngDate).Select

Fails at line 3 with the following error:

Application Defined or object defined error.

Can anyone help me please?

Thanks.

Nick


Charlie

What am I missing here?
 
You can't select a range of a range, if I'm making sense. I.E., you're
setting RngDate as a range, and then trying to use it in another range
statement. Either do (1) or (2)

1) simply select the range this way:
ThisWorkbook.Worksheets("Summary Report").Range("A" & i).Select

or 2) if cell "A?" has a valid range syntax in it e.g. "A1" contains the
string "B1"
ThisWorkbook.Worksheets("Summary Report").Range(Cells(i, "a").Value).Select


"Nick Smith" wrote:

Using the following code

Dim RngDate As Range
Set RngDate = ThisWorkbook.Worksheets("Summary Report").Range("A" & i)
ThisWorkbook.Worksheets("Summary Report").Range(RngDate).Select

Fails at line 3 with the following error:

Application Defined or object defined error.

Can anyone help me please?

Thanks.

Nick


Dave Peterson

What am I missing here?
 
Remember that you can only select a range on a worksheet that's active.

You may need:

thisworkbook.activate
worksheets("summary report").select
rngdate.select

if you don't use application.goto.



Nick Smith wrote:

Using the following code

Dim RngDate As Range
Set RngDate = ThisWorkbook.Worksheets("Summary Report").Range("A" & i)
ThisWorkbook.Worksheets("Summary Report").Range(RngDate).Select

Fails at line 3 with the following error:

Application Defined or object defined error.

Can anyone help me please?

Thanks.

Nick


--

Dave Peterson


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com