[ gatalinka @ 10.12.2009. 18:50 ] @
evo koda, a onda ću objasniti problem Sub nadi() Dim trazi As String Dim rng As Range Dim Msg, Style, Title, Help, Ctxt, Response, MyString trazi = InputBox("ŠTO SE TRAŽI", "TRAŽENJE ZADANOG KRITERIJA") Cells.Find(what:=trazi, after:=ActiveCell, LookIn:=xlFormulas, lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlNext, searchformat:=True).Activate Do If trazi = True Then Msg = "Želite li selektirati i obrisati red?" Style = vbYesNoCancel + vbInformation + vbDefaultButton2 ' Define buttons. Title = "DALJNJI POSTUPCI" ' Define title. 'Help = "DEMO.HLP" ' Define Help file. 'Ctxt = 1000 ' Define topic ' context. ' Display message. Response = MsgBox(Msg, Style, Title, Help, Ctxt) If Response = vbYes Then ' User chose Yes. Set rng = ActiveSheet.UsedRange.Find(trazi) Rows(rng.Row).Delete Else ' User chose No. Cells.Find(what:=trazi, after:=ActiveCell, LookIn:=xlFormulas, lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlNext, searchformat:=True).Activate End If If Response = vbCancel Then Exit Sub End If End If Loop End Sub kada u varijablu trazi upišem broj, tada ovo gore radi normalno, a kada upišem neki tekst (mobis ili sl), javlja grešku. (nije mi jasno jer je var trazi dimenzionirana kao string) inače, kod traži neku vrijednost, i po potrebi briše red ili ide dalje ili izađe. |