Hi, Im getting an error when I try to run a Ubound Sub example found in this link https://www.wallstreetmojo.com/vba-ubound/
Please can you help me understand what is wrong/missing in the code? Thank you.
Please can you help me understand what is wrong/missing in the code? Thank you.
VBA Code:
Sub Ubound_Example2()
Dim DataRange() As Variant
Sheets("Data Sheet").Activate
DataRange = Range("A2", Range("A1").End(xlDown).End(xlToRight))
Worksheets.Add
Range(ActiveCell, ActiveCell.Offset(UBound(DataRange, 1) - 1, UBound(DataRange, 2) - 1)) = DataRange
Erase DataRange
End Sub