Hi,
I have below code i use to determine to range with last used cell. However it returns the last used cell with formula that returns blank. Is there a way to modify the code where it returns the range with values so that range doesn't includes formula returning blank value.
I have below code i use to determine to range with last used cell. However it returns the last used cell with formula that returns blank. Is there a way to modify the code where it returns the range with values so that range doesn't includes formula returning blank value.
Sub DynamicRange()
Dim sht As Worksheet
Dim lastRow As Long
Dim LastColumn As Long
Dim StartCell As Range
Set sht = Worksheets("Sku Priority Tracking")
Set StartCell = Range("C7")
'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