Hi,
I have some macro to do, and I stop in one point. I dunno how to create a massive dynamic ranges for formulas in VBA. Let me show my code so far (this is just a part of the macro)
Sub Macro2()
'
' Macro2 Macro
'
'
ActiveWorkbook.Worksheets("T-0").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("T-0").AutoFilter.Sort.SortFields.Add Key:=Range( _
"B1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("T-0").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = _
"=INDEX('[macrofile.xlsb]T-1'!C2,MATCH(OFFSET(RC,0,2),'[macrofile.xlsb]T-1'!C4,0))"
End Sub
What I need is the macro should activate the Sort, and jump to the last Filled line, after Fill out the blank ones till the end of the table....
OK, so my problem is, I do not know, where should start the formula. I know that the formula should stop at the lastrow... with line like this:
lastrow = ActiveSheet.UsedRange.SpecialCells(xlLastCell).Row
Range("****" & lastrow)
How can I set the proper range?
Could anyone help me? that would be awesome.
Thanks in Advance,
Arrabonae
Bookmarks