Sunday 4 December 2016

excel - I'm attempting to copy a range with variable arguments

I've tried the following unsuccessfully.


Sub TestRange()


Dim example As Range


Dim RangeStart As Long


Dim RangeEnd As Long


RangeStart = ActiveSheet.Cells(1, 1)


RangeEnd = ActiveSheet.Cells(3, 4)


Dim ws As Worksheet


Set ws = Worksheets("Sheet5")


With ws


example = ws.Range("E" & .Rows.Count).End(xlUp).Row
Set example = Range(.Cells(RangeStart, 1), .Cells(RangeEnd, 8))

End With


example.Select


Selection.Copy


End Sub

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...