12k 31

Excel simple search cycle

How to implement vlookup function in MS Excel VBA
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
Public Function searchstring(ByVal sString As String, ByVal iColumn As Integer) As String ' iColumn sets vlookup colum to be returned ' set cycle lenght Dim iTable As Integer iTable = 100 ' result set to blank by default Dim sResult As String sResult = "" Sheets("Sheet").Select For n = 2 To 1 + iTable If sString = Cells(n, 1) Then SResult = Cells(n, iColumn) n = 100 End If Next n Sheets("Original Sheet").Select searchstring = sResult End Function
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus