unknownymous
Board Regular
- Joined
- Sep 19, 2017
- Messages
- 249
- Office Version
- 2016
- Platform
- Windows
Hi Guys,
I'm trying to work on a macro but I'm just recording it and here's what I got:
Sub Macro1()
ActiveCell.FormulaR1C1 = "=VLOOKUP(C1,PvA!C2:C17,16,0)"
Range("AB5").Select
Selection.Copy
Application.Goto Reference:="R10000C28"
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Replace What:="#N/A", Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
Range("C1").Select
Selection.End(xlUp).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Range("A1").Select
End Sub
Can you help me simplify the codes. As for filling down the formula, it should be based on the last non-empty cell (I just set as 10000).
Any thoughts will be much appreciated.
I'm trying to work on a macro but I'm just recording it and here's what I got:
Sub Macro1()
ActiveCell.FormulaR1C1 = "=VLOOKUP(C1,PvA!C2:C17,16,0)"
Range("AB5").Select
Selection.Copy
Application.Goto Reference:="R10000C28"
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Replace What:="#N/A", Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
Range("C1").Select
Selection.End(xlUp).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Range("A1").Select
End Sub
Can you help me simplify the codes. As for filling down the formula, it should be based on the last non-empty cell (I just set as 10000).
Any thoughts will be much appreciated.