kevin440red
New Member
- Joined
- May 23, 2011
- Messages
- 26
- Office Version
- 2019
I recorded a Macro and now I'm trying to edit it to auto fill to the last row.
this is what i have so far.
Thanks
this is what i have so far.
Thanks
Code:
Range("C2").Select Range(Selection, Selection.End(xlDown)).Select
ActiveWindow.SmallScroll Down:=-234
Application.Run "'ILCHotSheet (v3).xlsx'!BAZINGA_007"
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("C1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("N2").Select
[COLOR=#ff0000]ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-11],Sheet2!RC[-13]:R[13666]C[-12],2,0)[/COLOR]"
[COLOR=#ff0000] Range("O2").Select[/COLOR]
[COLOR=#ff0000] ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-12],Sheet2!RC[-14]:R[13666]C[-12],3,0)"[/COLOR]
[COLOR=#ff0000] Range("N2:O2").Select[/COLOR]
[COLOR=#ff0000] Selection.AutoFill Destination:=Range("N2:O2")[/COLOR]
[COLOR=#ff0000] Range("N2:O2").Select[/COLOR]
[COLOR=#ff0000] Range("N2:O2").AutoFill Destination:=Range("N2:N, O2:0" & lastRow)[/COLOR]
Cells.Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub