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
Post a Comment