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

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
976
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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,215,172
Messages
6,123,428
Members
449,099
Latest member
COOT

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