excel - How to select the cell when case is true -


first off, starting trying learn excel , vba yesterday....so bear in mind.

private sub commandbutton2_click()  = 1 mylastrow     select case activeworkbook.sheets("sheet2").cells(a, 2).value         case = myordernumber             activeworkbook.sheets("sheet2").cells(a, 2).active         case false: msgbox "false"     end select next end sub 

i want know cell or row of cell matches variable. not want.......

thanks guys

try this

private sub commandbutton2_click() dim mylastrow long, long, myordernumber long  mylastrow = 10 = 1 mylastrow     activeworkbook.sheets("sheet2")         if .cells(a, 2).value = myordernumber             msgbox "true " & .cells(a, 2).row         else             msgbox "false"         end if     end next end sub 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -