• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macros for Vloolup in excle

Harsha_1804

New Member
HI ,

I tried using recording macros but result was not correct (code is below) , and when i add additional data to same sheet it wont apply formula to the extra added data ,while
applying manual v-lookup to the same date i am getting correct data,



1-My manual Vlookup formula
=VLOOKUP($B:$B,'Order DATA'!$B:$E,4,0)

upload_2017-6-17_13-40-45.png


2- VAB Record

Code:
Sub VLOOKUP_CEK()
'
' VLOOKUP_CEK Macro
'

'
    ActiveCell.FormulaR1C1 = "=VLOOKUP(C2,'Order DATA'!C2:C5,4,0)"
    Range("E2").Select
    ActiveCell.FormulaR1C1 = "=VLOOKUP(C2,'Order DATA'!C2:C6,5,0)"
    Range("F2").Select
    ActiveCell.FormulaR1C1 = "=VLOOKUP(C3,'Order DATA'!C3:C5,3,0)"
    Range("G2").Select
    ActiveCell.FormulaR1C1 = "=VLOOKUP(C3,'Order DATA'!C3:C6,4,0)"
    Range("E3").Select
    Selection.End(xlDown).Select
    Range("C1048576").Select
    Selection.End(xlUp).Select
    Range("D2180:G2180").Select
    Range(Selection, Selection.End(xlUp)).Select
    Range(Selection, Selection.End(xlUp)).Select
    Range("D2:G2180").Select
    Range("D2180").Activate
    Selection.FillDown
    Range("D2").Select
End Sub
 

Attachments

  • Simple.xlsm
    112.4 KB · Views: 4
Last edited by a moderator:
Back
Top