Hello,
I'm trying to develop a vba code to use excel as a search engine. I have created a cell which bears the input(in sheet(2)). I want excel to search for the input(which lies in the first column of Sheet(1)) , once it's found, take every column corresponding to the result and search for it in sheet(3). If found there, it should return me the value in its adjacent cell(sheet(3)) at a defined place in sheet(2)
Here's my code for it. Can anyone please help me with it?
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #011993}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; background-color: #fffb00}span.s1 {color: #000000}span.s2 {color: #011993}</style>
Sub sku()
Dim erow As Long
Dim ws As Worksheet
Dim lastrow As Long
Dim count As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
lastrow = Sheets(1).Cells(Rows.count, 1).End(xlUp).Row
lastrow1 = Sheets(3).Cells(Rows.count, 1).End(xlUp).Row
lastcolum = Sheets(1).Cells(1, Columns.count).End(xlUp).Column
For x = 2 To lastrow
If Sheets(1).Cells(x, 1) = Sheets(2).Range("A2") Then
For y = 3 To lastcolumn
For z = 1 To lastrow1
If Sheets(1).Cells(x, y) = Sheets(3).Cells(z, 1) Then
Sheets(2).Range("J& z") = Sheets(3).Cells(z, 2)
End If
Next z
Next y
End If
Next x
End Sub
I'm trying to develop a vba code to use excel as a search engine. I have created a cell which bears the input(in sheet(2)). I want excel to search for the input(which lies in the first column of Sheet(1)) , once it's found, take every column corresponding to the result and search for it in sheet(3). If found there, it should return me the value in its adjacent cell(sheet(3)) at a defined place in sheet(2)
Here's my code for it. Can anyone please help me with it?
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #011993}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; background-color: #fffb00}span.s1 {color: #000000}span.s2 {color: #011993}</style>
Sub sku()
Dim erow As Long
Dim ws As Worksheet
Dim lastrow As Long
Dim count As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
lastrow = Sheets(1).Cells(Rows.count, 1).End(xlUp).Row
lastrow1 = Sheets(3).Cells(Rows.count, 1).End(xlUp).Row
lastcolum = Sheets(1).Cells(1, Columns.count).End(xlUp).Column
For x = 2 To lastrow
If Sheets(1).Cells(x, 1) = Sheets(2).Range("A2") Then
For y = 3 To lastcolumn
For z = 1 To lastrow1
If Sheets(1).Cells(x, y) = Sheets(3).Cells(z, 1) Then
Sheets(2).Range("J& z") = Sheets(3).Cells(z, 2)
End If
Next z
Next y
End If
Next x
End Sub