I Could really use some help with converting an Excel formula into VB. Frankly I just don't know enough about VB to even get started and my current worksheets have ran out of realestate - thus I'm going to have to add a VB form search. Let me first put some insight into this. I have 12 identical laid out worksheets labeled from January thru December but with just different data. I need to be able to search all sheets in the range (B5:B2400) for a numerical match and if found return the left cell text value found in the range (A5:A2400) and if nothing / #N/A then "No records found". I tid bit of my working Excel formula is (the remaining months would be nested in this as well):
=IFERROR(INDEX(October!A5:A2400,MATCH(J16,October!B5:B2400,0)),IFERROR(INDEX(November!A5:A2400,MATCH(J16,November!B5:B2400,0)),INDEX(December!A5:A2400,MATCH(J16,December!B5:B2400,0))))
Tried piecing this together but not working
Thanks for any help it is greatly appreciated
=IFERROR(INDEX(October!A5:A2400,MATCH(J16,October!B5:B2400,0)),IFERROR(INDEX(November!A5:A2400,MATCH(J16,November!B5:B2400,0)),INDEX(December!A5:A2400,MATCH(J16,December!B5:B2400,0))))
Tried piecing this together but not working
Code:
Private Sub CommandButton1_Click()
row_number = 5
Do
DoEvents
row_number = row_number + 1
rec_search = Sheets("January").Range("B" & row_number)
If rec_search = TextBox1.Text Then
TextBox2.Text = Sheets("January").Range("A" & row_number)
'Else: TextBox2.Text = "Cloud Record Not Found"
End If
Loop Until rec_search = ""
End Sub
Last edited by a moderator: