Hi all-
I am attempting to combine column letter with row number to create a range. Basically, I am trying to find last row and last column and assign that as my "DataRange" at the beginning of this Sub so that I can sort/subtotal based on that range. Below is the beginning of my code:
Sub BillingSutotals()
'
' BillingSutotals Macro
' The macro sorts and subtotals by the Number, Memo, and Sales Price
'
Sub Subtotal()
Dim EndRow As Integer, EndCol As String
Dim DataRange As String
Range("A1").Select
Selection.End(xlDown).Select
EndRow = ActiveCell.Row
Range("A1").Select
Selection.End(xlToRight).Select
EndCol = Split(ActiveCell(1).Address(1, 0), "$")(0)
DataRange = "A1:" & EndCol & EndRow
After reading a few articles, I tried the code below but had no success:
DataRange = "A1" & ":" & EndCol & CStr(EndRow)
DataRange = "A1" & ":" & LTrim(EndCol & Str(EndRow))
Any ideas as to how to set my DataRange with the information I currently have?
I am attempting to combine column letter with row number to create a range. Basically, I am trying to find last row and last column and assign that as my "DataRange" at the beginning of this Sub so that I can sort/subtotal based on that range. Below is the beginning of my code:
Sub BillingSutotals()
'
' BillingSutotals Macro
' The macro sorts and subtotals by the Number, Memo, and Sales Price
'
Sub Subtotal()
Dim EndRow As Integer, EndCol As String
Dim DataRange As String
Range("A1").Select
Selection.End(xlDown).Select
EndRow = ActiveCell.Row
Range("A1").Select
Selection.End(xlToRight).Select
EndCol = Split(ActiveCell(1).Address(1, 0), "$")(0)
DataRange = "A1:" & EndCol & EndRow
After reading a few articles, I tried the code below but had no success:
DataRange = "A1" & ":" & EndCol & CStr(EndRow)
DataRange = "A1" & ":" & LTrim(EndCol & Str(EndRow))
Any ideas as to how to set my DataRange with the information I currently have?