A
Ade
I seem to have a lot of difficulty using / selecting ranges that i have
defined on different Worksheets. I have read that you need to explictly
define the range which I often try to do - with usually poor results as I
always get the syntax wrong.
My current problem occurs in the following code module :-
Dim Range1 As Range
Dim Range2 As Range
Dim StartRange1 As Integer
Dim EndRange1 As Integer
Dim StartRange2 As Integer
Dim EndRange2 As Integer
Const RangeSize As Integer = 55
Sub Init()
StartRange1 = 3
EndRange1 = 57
StartRange2 = 2
EndRange2 = 56
Set Range1 = Range("A" & StartRange1 & ":" & "A" & EndRange1)
Set Range2 = Worksheets("ColumnSplits").Range("A" & StartRange2 & ":" &
"A" & EndRange2)
Range1.Select
With Worksheets("ColumnSplits")
.Range2.Select
End With
End Sub
Error : 'Object does not support this property or method' at the line near
the bottom '.Range2.Select'.
Anyone who can suugest the correct code to Select Range2? Also is there any
usefull methods for figuring out which code syntax you have to use when
working with ranges on different Worksheets as it never seems obvious to me,
for example in my code I can not see why the line '.Range2.Select' will not
work, it seems like the obvious solution to me.
Cheers
defined on different Worksheets. I have read that you need to explictly
define the range which I often try to do - with usually poor results as I
always get the syntax wrong.
My current problem occurs in the following code module :-
Dim Range1 As Range
Dim Range2 As Range
Dim StartRange1 As Integer
Dim EndRange1 As Integer
Dim StartRange2 As Integer
Dim EndRange2 As Integer
Const RangeSize As Integer = 55
Sub Init()
StartRange1 = 3
EndRange1 = 57
StartRange2 = 2
EndRange2 = 56
Set Range1 = Range("A" & StartRange1 & ":" & "A" & EndRange1)
Set Range2 = Worksheets("ColumnSplits").Range("A" & StartRange2 & ":" &
"A" & EndRange2)
Range1.Select
With Worksheets("ColumnSplits")
.Range2.Select
End With
End Sub
Error : 'Object does not support this property or method' at the line near
the bottom '.Range2.Select'.
Anyone who can suugest the correct code to Select Range2? Also is there any
usefull methods for figuring out which code syntax you have to use when
working with ranges on different Worksheets as it never seems obvious to me,
for example in my code I can not see why the line '.Range2.Select' will not
work, it seems like the obvious solution to me.
Cheers