errorhandler fault

  • Thread starter Thread starter tinybears
  • Start date Start date
T

tinybears

Hey,

I have this problem: In my vba code there is an errorhandler that
should make a pop-up if a certain errorcode appears and continious when
there is nog problem with that kind of code. The problem now is that
when the code 1004 let's the msgbox appear, that I still get the
message because it's in a loop. How do I solve this?

thx


ErrHandler:

If Err.Number = 1004 Then
MsgBox "Gelieve het correcte tickersymbool in te geven. Indien
verdere problemen kan u altijd contact opnemen met de ontwikkelaar van
deze spreadsheet via e-mail: (e-mail address removed)."

'Voortzetten NextLine
Else

NextLine:

Windows("Thesis5").Activate
Sheets("Data").Select
'Data sorteren
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal


Sheets("Data").Select
Do While Cells(j, 1) <> ""

For k = 1 To 7
Sheets("Data").Select
Price1(k) = Cells(j, k)
Price2(k) = Cells(j + 1, k)

Next k

If Price1(1) = Price2(1) Then
GoTo NextLoop
Else
For m = 1 To 7
Sheets("Data2").Select
Cells(l, m) = Price1(m)
Next m
l = l + 1
End If



NextLoop:
j = j + 1
Sheets("Data").Select


Loop


End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top