Laufzeitfehler '13': Typen unverträglich
21.09.2007 11:46:46
Matthias
ich habe ein kleines Problem, bei dem ihr mir sicherlich rasch helfen könnt.
Ich habe folgendes Makro, dass bis gestern funktioniert hat und heute auf einmal nicht mehr. Der Fehler ist in der fett markierten Zeile:
Option Explicit
Private Sub Aktualisieren_Click()
Dim WkSh As Worksheet
Dim iBlaetter As Integer
Dim lZeilen As Long
Dim lLetzte As Long
Dim sHighValues As String
Dim iIndx As Integer
Dim sArgument As String
Dim aWerte(1000) As String
Dim iAnzahl As Long
Application.ScreenUpdating = False
For iIndx = 1 To 20
sHighValues = sHighValues & Chr(255)
Next iIndx
For iIndx = 1 To 1000
aWerte(iIndx) = sHighValues
Next iIndx
For Each WkSh In ThisWorkbook.Worksheets
If WkSh.Name "Startseite" And WkSh.Name "Übersicht Währungen" And WkSh.Name "Ü _
bersicht Aktien" _
And WkSh.Name "Übersicht Bonds" And WkSh.Name "Übersicht Fonds" And WkSh.Name "Ü _
bersicht VVs" _
And WkSh.Name "Übersicht Charts" And WkSh.Name "Ordner005 kumm." And WkSh.Name " _
Ordner006 kumm." _
And WkSh.Name "Ordner007 kumm." And WkSh.Name "Ordner008 kumm." _
And WkSh.Name "Anlagegewichtung VVs" Then
lLetzte = IIf(WkSh.Range("E65536") "", _
65536, WkSh.Range("E65536").End(xlUp).Row)
For lZeilen = 5 To lLetzte
If WkSh.Range("E" & lZeilen).Value "" Then
sArgument = CStr(WkSh.Range("E" & lZeilen).Value)
GoSub SortiertSpeichern
End If
Next lZeilen
End If
Next WkSh
For iIndx = 1 To UBound(aWerte)
If aWerte(iIndx) sHighValues Then iAnzahl = iAnzahl + 1
Next iIndx
'MsgBox "Anzahl Einträge ist = " & iAnzahl
With Worksheets("Startseite").ComboBox2
.Clear
For iIndx = 0 To iAnzahl - 1
.AddItem aWerte(iIndx + 1), iIndx
Next iIndx
.ListIndex = 0
End With
Application.ScreenUpdating = True
Exit Sub ' Ende Sub
' Daten sortiert in ein Array speichern '
SortiertSpeichern:
iIndx = 1
' Die Tabelle auf Vorhandensein der Daten absuchen '
' Es werden keine Werte doppelt in die Tabelle übernommen '
Do While iIndx 1
If sArgument
Private Sub ComboBox1_Change()
If Not noEvent Then Sheets(ComboBox1.Text).Activate
End Sub
Private Sub ComboBox2_Change()
Dim ii As Byte, lngNext&, zz&, wks As Worksheet
If noEvent Then Exit Sub
lngNext = Cells(Rows.Count, 1).End(xlUp).Row
If lngNext >= 11 Then Range(Cells(11, 1), Cells(lngNext, 8)).ClearContents
lngNext = 11
For Each wks In ThisWorkbook.Worksheets
If wks.Name "Startseite" And wks.Name "Übersicht Währungen" And wks.Name "Ü _
bersicht Aktien" _
And wks.Name "Übersicht Bonds" And wks.Name "Übersicht Fonds" And wks.Name "Ü _
bersicht VVs" _
And wks.Name "Übersicht Charts" And wks.Name "Ordner005 kumm." And wks.Name " _
Ordner006 kumm." _
And wks.Name "Ordner007 kumm." And wks.Name "Ordner008 kumm." _
And wks.Name "Anlagegewichtung VVs" Then
For zz = 4 To wks.Cells(Rows.Count, 5).End(xlUp).Row
If wks.Cells(zz, 5) = ComboBox2.Value Then
Cells(lngNext, 1) = wks.Cells(zz, 27)
Cells(lngNext, 2) = wks.Cells(zz, 3)
Cells(lngNext, 3) = wks.Cells(zz, 5)
Cells(lngNext, 4) = wks.Cells(zz, 6)
Cells(lngNext, 5) = wks.Cells(zz, 8)
Cells(lngNext, 6) = wks.Cells(zz, 9)
Cells(lngNext, 7) = wks.Cells(zz, 26)
Cells(lngNext, 8) = wks.Cells(zz, 17)
lngNext = lngNext + 1
End If
Next zz
End If
Next wks
Cells(11, 1).Select
End Sub
Danke für eure Hilfe!