Reputation: 85
I am not very familiar with VBA programming, though I have written a few basic modules. I am having some difficulty in coding the following problem. I would appreciate if someone could show a basic solution. Problem: I have 3 tabs in an Excel file, "Rack1", "Rack2" and "Rack3". They each have a column called "tag". The tag column contains a code, made up of numerals 0 to 9999 and one letter, A or B. I want to look up the first "A" code in Rack1, then find the matching "B" code. If the B code is not in tab "Rack1", I want to search tab "Rack2", then "Rack3" if it's not found in either. After the "B" part is found, I want to have a Msgbox message - "Found in Rack..." OR "B part not found"
Then ... go on to the next A code. Thanks
Upvotes: 0
Views: 74
Reputation: 625
Please let us know what have you tried so far to get things working at your end.
You may have to loop through with your requirement with all sheets with respective column and its range.
I am not very clear, what is your exact requirement but you can do something like this
declare variables of your sheets
Set sheet1 = Worksheets("Sheet1")
Set sheet2 = Worksheets("Sheet2")
Set sheet3 = Worksheets("Sheet3")
You have to set range as per your need. Now you have to loop your sheet1 and tag column. While searching you need check whether A is exist in respective cell by cell value see below example
If InStr(cell_value, "A") > 0 Then
Meanwhile you can check below post for your further reference.
Excel Looping through rows and copy cell values to another worksheet
Upvotes: 1