Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Variable ranges

Hi,
As i write my code the range that i'm referring to changes. To identify the
lower and the upper limits of the range i use the following

BeginRange = Worksheets("Content").Cells(5, col).Address
EndRange = Worksheets("Content").Cells(Row, col).Address

Now, as i select this range and try to copy it elsewhere i'm trying to use
the following expression:

Worksheets("Content").Range("" & BeginRange & " :" & EndRange & "").Select

Every time I get to this point i get an error '1004' - "Application defined
or object defined error"

Can anyone please advise as to what is going on and how to get arround it?

Thanks a bunch
Igor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Variable ranges

Must be something wrong with the values in Row and col. What do they contain
at that point.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"igorek" wrote in message
...
Hi,
As i write my code the range that i'm referring to changes. To identify

the
lower and the upper limits of the range i use the following

BeginRange = Worksheets("Content").Cells(5, col).Address
EndRange = Worksheets("Content").Cells(Row, col).Address

Now, as i select this range and try to copy it elsewhere i'm trying to use
the following expression:

Worksheets("Content").Range("" & BeginRange & " :" & EndRange & "").Select

Every time I get to this point i get an error '1004' - "Application

defined
or object defined error"

Can anyone please advise as to what is going on and how to get arround it?

Thanks a bunch
Igor



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Variable ranges

If Content isn't the activesheet, you can get this error.

Worksheets("Content").select
Worksheets("Content").Range("" & BeginRange & " :" & EndRange & "").Select

But you could have used:
Worksheets("Content").Range(BeginRange & ":" & EndRange).Select

But I think most would just use:
Worksheets("Content").Range(BeginRange, EndRange).Select



igorek wrote:

Hi,
As i write my code the range that i'm referring to changes. To identify the
lower and the upper limits of the range i use the following

BeginRange = Worksheets("Content").Cells(5, col).Address
EndRange = Worksheets("Content").Cells(Row, col).Address

Now, as i select this range and try to copy it elsewhere i'm trying to use
the following expression:

Worksheets("Content").Range("" & BeginRange & " :" & EndRange & "").Select

Every time I get to this point i get an error '1004' - "Application defined
or object defined error"

Can anyone please advise as to what is going on and how to get arround it?

Thanks a bunch
Igor


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Variable ranges

Bob,

the value of each reflects the cell.address $z$1 for BeginRange and $z$50
for EndRange. So, the variables are fine and are declared as variant.

Thanks for your help



"Bob Phillips" wrote:

Must be something wrong with the values in Row and col. What do they contain
at that point.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"igorek" wrote in message
...
Hi,
As i write my code the range that i'm referring to changes. To identify

the
lower and the upper limits of the range i use the following

BeginRange = Worksheets("Content").Cells(5, col).Address
EndRange = Worksheets("Content").Cells(Row, col).Address

Now, as i select this range and try to copy it elsewhere i'm trying to use
the following expression:

Worksheets("Content").Range("" & BeginRange & " :" & EndRange & "").Select

Every time I get to this point i get an error '1004' - "Application

defined
or object defined error"

Can anyone please advise as to what is going on and how to get arround it?

Thanks a bunch
Igor




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Variable ranges

That value works fine for me. You would get an error if Content is not the
activesheet as Dave suggested, but that is a different error than the one
that you reported. Have you debugged it to see what the range being referred
to is?

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"igorek" wrote in message
...
Bob,

the value of each reflects the cell.address $z$1 for BeginRange and $z$50
for EndRange. So, the variables are fine and are declared as variant.

Thanks for your help



"Bob Phillips" wrote:

Must be something wrong with the values in Row and col. What do they

contain
at that point.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"igorek" wrote in message
...
Hi,
As i write my code the range that i'm referring to changes. To

identify
the
lower and the upper limits of the range i use the following

BeginRange = Worksheets("Content").Cells(5, col).Address
EndRange = Worksheets("Content").Cells(Row, col).Address

Now, as i select this range and try to copy it elsewhere i'm trying to

use
the following expression:

Worksheets("Content").Range("" & BeginRange & " :" & EndRange &

"").Select

Every time I get to this point i get an error '1004' - "Application

defined
or object defined error"

Can anyone please advise as to what is going on and how to get arround

it?

Thanks a bunch
Igor








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Variable ranges

So foolish of me, thank you guys
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
variable ranges gramps Excel Discussion (Misc queries) 4 February 4th 10 02:33 PM
Help with Variable Ranges! Nelson B. Excel Discussion (Misc queries) 1 August 21st 08 03:30 PM
Counting variable ranges and auto-summing variable ranges Father Guido[_5_] Excel Programming 2 March 29th 06 04:07 AM
Variable ranges John Contact Excel Worksheet Functions 1 June 17th 05 08:02 AM
Sum Variable Ranges Erika Excel Worksheet Functions 6 December 23rd 04 03:52 PM


All times are GMT +1. The time now is 11:56 PM.

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"