Oberon70
Board Regular
- Joined
- Jan 21, 2022
- Messages
- 160
- Office Version
- 365
- Platform
- Windows
I have different statements that are different lengths and I want to be able to obtain the range based on what is in the DATA file of the statement.
I am still trying to wrap my head around RC1, but I was using the below code, which isn't working.
Any advice would be great as I have only started to learn VBA.
I am still trying to wrap my head around RC1, but I was using the below code, which isn't working.
VBA Code:
Sub custom_sort()
'
' custom_sort Macro
Dim No_of_Columns As Integer
Dim ColRng As Range
Set ColRng = Range("A:A")
'Set RowRng = Range("A1:AA1")
No_Of_Rows = WorksheetFunction.CountA(RowRng) - 2
No_of_Columns = WorksheetFunction.CountA(ColRng)
Range(Cell1, Cell & No_of_Columns).Select
ActiveWorkbook.Names.Add Name:="DD", RefersToR1C1:= _
"=data!R1C7:R1141C" & No_Of_Rows
ActiveWorkbook.Names("DD").Comment = ""
Any advice would be great as I have only started to learn VBA.