Sub Marki()
'Deklarierung der Variablen
Dim lZeilen As Long
Dim lSpalten As Long
Dim z As Range
Dim i As Integer
Dim j As Integer
Dim r As Integer
Dim s As Integer
i = 2
j = 2
s = 2
r = 2
'Auswählen des Bereichs und Einstellung der Farbe auf "Null"
'Sheet1.[Prüf1].Select
'Selection.Interior.ColorIndex = xlNone
Sheet1.[Matrix].Select
Selection.Interior.ColorIndex = xlNone
'Einfärben der Zellen abhängig von den Bedingungen und export der Felder in ein anderes Sheet
'For Each z In Sheet1.[Prüf1]
' If z >= 0.1 And z <= 0.3 Then
' z.Interior.Color = RGB(9, 214, 6)
' Sheet2.Cells(i, 1).Value = "zwischen 0,1 und 0,3"
' Sheet2.Cells(i, 2).Value = z.Address
' Sheet2.Cells(i, 3).Value = z.Column
' Sheet2.Cells(i, 4).Value = z.Row
' i = i + 1
'
' Else
' If z >= 0.5 And z <= 0.9 Then
' z.Interior.Color = RGB(146, 255, 26)
' Sheet2.Cells(j, 5).Value = "zwischen 0,5 und 0,9"
' Sheet2.Cells(j, 6).Value = z.Address
' Sheet2.Cells(j, 7).Value = z.Column
' Sheet2.Cells(j, 8).Value = z.Row
' j = j + 1
'
' End If
' End If
' Next
For Each z In Sheet1.[Matrix]
If z = "SoD" Then
z.Interior.Color = RGB(9, 214, 6)
Sheet2.Cells(i, 1).Value = z
Sheet2.Cells(i, 2).Value = z.Address
Sheet2.Cells(i, 3).Value = z.CurrentRegion.row_number
Sheet2.Cells(i, 4).Value = z.Cells(1, Column_num)
' s = z.Column
' r = z.Row
'
'
' Sheet2.Cells(1, 3).Value = "Spalten"
' Sheet2.Cells(i, 3).Value = s
' Sheet2.Cells(1, 4).Value = "Reihen"
' Sheet2.Cells(i, 4).Value = r
' Sheet2.Cells(i, 3).Value = z.Cells(30, s).Value 'Spalten
' Sheet2.Cells(i, 4).Value = z.Cells(r, 2).Value 'Zeilen
Sheet2.Cells(i, 5).Value = z.Value
Debug.Print s; "---"; r
i = i + 1
Else
If z = "4EP" Then
z.Interior.Color = RGB(146, 255, 26)
Sheet2.Cells(j, 6).Value = z
Sheet2.Cells(j, 7).Value = z.Address
s = z.Column
r = z.Row
Sheet2.Cells(1, 8).Value = "Spalten"
Sheet2.Cells(j, 3).Value = s
Sheet2.Cells(1, 9).Value = "Reihen"
Sheet2.Cells(j, 4).Value = r
' Sheet2.Cells(j, 8).Value = z.Cells(30, s).Value
' Sheet2.Cells(j, 9).Value = z.Cells(r, 2).Value
Sheet2.Cells(j, 10).Value = z.Value
Debug.Print s; "---"; r
j = j + 1
End If
End If
Next
lZeilen = UsedRange.Rows.Count ' Die Anzahl Zeilen werden bestimmt
lSpalten = UsedRange.Columns.Count ' Die Anzahl Spalten werden bestimmt
Debug.Print lZeilen
Debug.Print lSpalten
End Sub
|