excel - vba check value in column then check month and year of date in another column? -


I am looking for a value in sheet 2 in column A. The code below works fine, and if the value is found it shows the message and it does not get found if the value is not found.

  Private Sub-Worksheet_SelectionChange (Range as Target byVal) then target.Address = "$ A $ 1" then find the string as the FindString string as the Range Range Range = Range ("B1"). If the price is trim (searchstring) & lt; & Gt; "" Then the sheet ("Sheet2") range. ("A: A") 'All of the search columns are RNG = .find (followed by: = FindString, _: = cells (.Cells.Count), _ watching: = xlValues, _ lookAt: = xlWhole , _ SearchOrder: = xlByRows, _SearchDirection: = xlNext, _MatchCase: = false) not RNG is nothing then MsgBox is "found" while 'value is not found; otherwise MsgBox' nothing found "value 'not found If the end is finished then the end  

what I want to do is add this code so that column A also searches for column B for a call. Different prices? And then if both values ​​are present then they could not find and found.

Can anyone show me how I can do this? Thanks to

To keep up with your flow, maybe add another find:

 With  sheet ("Sheet2") range ("A: A"). 'Search all the columns in a set RNG = .find (after: = FindString, _:: = cells (.Cells.Count), _ watching: = XlValues, _ LookAt: = xlWhole, _SearchOrder: = xlByRows, _SearchDirection : = XlNext, _MainCase: = False) If No Rng is Nothing then MsgBox "Col A Value" FindString = "& lt; Different Search String" With Sheets ("Sheet 2"). Range ("B: B") 'column B set RNG = searches for all.' (What: = "& lt; different search string"; _,: = calculation), _ watching: = xlValues, _ lookAt: = xlWhole, _SearchOrder: = xlByRows, _SearchDirection: = xlNext, _ MatchCase: = false) If there is nothing RNG then MsgBox gets "Both values ​​are found" while the value "MsgBox found" call B value did not get "value not found" if Else MSBBX "Call A value was not found" Value is not found if end and end end [ 

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -