Hello i want to get a relative range and i manage to capture it in an Object , and i want to consolidate it in a different sheet but i get an error always on the methode
here is my code :
Sub Test()
Dim rightRange As Range
Dim leftRange As Range
Dim intialDownrange As Range
Dim initialToprange As Range
Dim totalRange As Range
'Getting the Relative Range
Set rightRange = Worksheets("Details").Range("H1").End(xlDown)
Set leftRange = Worksheets("details").Range("r1").End(xlDown).Offset(-1, 0)
Set intialDownrange = Worksheets("Details").Range(rightRange, leftRange)
Set initialToprange = Worksheets("Details").Range("H2", "R2")
Set totalRange = Worksheets("Details").Range(intialDownrange, initialToprange)
Range("B2").Consolidate Sources:= totalRange
, Function:=xlSum, TopRow:=False, LeftColumn:=True, CreateLinks:=False
i always get a run time error says Consolidate methode of range class failed so pls help
here is my code :
Sub Test()
Dim rightRange As Range
Dim leftRange As Range
Dim intialDownrange As Range
Dim initialToprange As Range
Dim totalRange As Range
'Getting the Relative Range
Set rightRange = Worksheets("Details").Range("H1").End(xlDown)
Set leftRange = Worksheets("details").Range("r1").End(xlDown).Offset(-1, 0)
Set intialDownrange = Worksheets("Details").Range(rightRange, leftRange)
Set initialToprange = Worksheets("Details").Range("H2", "R2")
Set totalRange = Worksheets("Details").Range(intialDownrange, initialToprange)
Range("B2").Consolidate Sources:= totalRange
, Function:=xlSum, TopRow:=False, LeftColumn:=True, CreateLinks:=False
i always get a run time error says Consolidate methode of range class failed so pls help