Hi Sir,
I want to run macro for selected cell only. (Macro code mentioned below)
please help me in run macro for selected cell.
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+w
'
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-3],[26.07.21.xlsx]Sheet1!C1:C5,2,0)"
Range("G783").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC4,[26.07.21.xlsx]Sheet1!C1:C5,2,0)"
Range("G783").Select
Selection.Copy
Range("H783").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC4,[26.07.21.xlsx]Sheet1!C1:C5,3,0)"
Range("G783:H783").Select
Range("H783").Activate
Selection.AutoFill Destination:=Range("G783:H811")
Range("G783:H811").Select
ActiveWindow.SmallScroll Down:=21
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Replace What:="#n/a", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Application.CutCopyMode = False
Range("G784:H810").Select
Range("G810").Activate
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("G784").Select
End Sub