For each vlook up help.........

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
983
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

Below is my vlookup. this code is for single worksheet it works. I want to run this code for sheets {1,2,4,6} only and in column B1. if vlook up result give exact match it should display the result :=> For match "Old trades", else "New trades".

Colomn for vlookup is fix. (b:b). plz help.

Sub Test()
Dim lr As Long
Dim i As Integer
Dim wbk As Workbook
Set wbk = Workbooks.Open("E:\Software\For v lookup.xlsm")
wbk.Worksheets(1).Activate

On Error GoTo Pranay:
lr = Cells(Rows.Count, 1).End(xlUp).Row - 1
i = 1
For i = 1 To lr
Sheets(1).Range("b" & i + 1).Value = WorksheetFunction.VLookup(Sheets(1).Range("a" & i + 1).Value, ThisWorkbook.Sheets(3).Range("c:g"), 2, 0)
Next
Exit Sub
Pranay:
Sheets(1).Range("b" & i + 1).Value = " New Trade"
Resume Next
End Sub


Regards,
Mallesh
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top