I am trying to set a range to be manipulated using 4 integer variables that denote the top of the range cell row/column and the bottom of the range row/column. The range will always be one column wide but will be a varying number of rows long. I have tried various similar situations I have found on various forums, but I always seem to end up with a Run-time error 1004: Method Range; of object _Global failed. I have tried a few things and now I think I finally am ready to ask for help
how can I set variable rng to be [rTop][cTop]:[rBottom][cBottom] (cell example A34:A54)
Code:
Dim rTop, rBottom, cTop, cBottom As Integer
Dim cellTop, cellBottom, rng As Range
Range("A4").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select 'goes to new block of data, selects top cell of data
rTop = ActiveCell.Row
cTop = ActiveCell.Column
rng = Range(rTop, cTop)
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste 'paste another block of data at end of original block of data
Selection.End(xlDown).Select 'goes to bottom of combined data
rBottom = ActiveCell.Row
cBottom = ActiveCell.Column
Selection.End(xlUp).Select
Application.CutCopyMode = False
ActiveSheet.Range(rng).RemoveDuplicates Columns:=1, Header:=xlNo