Hi,
I have the following code which just highlights all the data in a worksheet. I want to take that data that is highlighted and use it to define a name such as CurrentMTH, I have a few things none of which are working. Any thoughts?
Sub DynRange()
Dim sht As Worksheet
Dim LastRow As Long
Dim LastColumn As Long
Dim StartCell As Range
Set sht = Worksheets("CURRENTMONTH")
Set StartCell = Range("a1")
'Find Last Row and Column
LastRow = sht.Cells(sht.Rows.Count, StartCell.Column).End(xlUp).Row
LastColumn = sht.Cells(StartCell.Row, sht.Columns.Count).End(xlToLeft).Column
'Select Range
sht.Range(StartCell, sht.Cells(LastRow, LastColumn)).Select
End Sub