Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
So foolish of me, thank you guys
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
variable ranges | Excel Discussion (Misc queries) | |||
Help with Variable Ranges! | Excel Discussion (Misc queries) | |||
Counting variable ranges and auto-summing variable ranges | Excel Programming | |||
Variable ranges | Excel Worksheet Functions | |||
Sum Variable Ranges | Excel Worksheet Functions |