ich möchte den nachfolgenden VBA-Code etwas verändern und zwar soll nicht der gesamte Zellinhalt verglichen werden, sondern nur der 1. Buchstabe/die erste Ziffer:
Public Sub Leere_Zeile_bei_Wechsel_in_Spalte()
On Error GoTo nix
Dim lngRow As Long
Dim M As String
M = InputBox(prompt:=vbCr & vbCr & vbCr & vbCr & vbCr & "Hier die Spalte eingeben!", Title:= _
"Spalte?", xpos:="6250", ypos:="4200")
If M = "" Then GoTo nix
Application.ScreenUpdating = False
For lngRow = Cells(Rows.Count, 1).End(xlUp).Row To 3 Step -1
If Cells(lngRow, M).Value Cells(lngRow - 1, M).Value And _
Not IsEmpty(Cells(lngRow, M)) And Not IsEmpty(Cells(lngRow - 1, M)) Then _
Rows(lngRow).Insert Shift:=xlShiftDown
Next
Application.ScreenUpdating = True
nix:
End Sub
Ich stelle mir das in etwa so vor:Public Sub Leere_Zeile_bei_Wechsel_in_Spalte()
On Error GoTo nix
Dim lngRow As Long
Dim M As String
M = InputBox(prompt:=vbCr & vbCr & vbCr & vbCr & vbCr & "Hier die Spalte eingeben!", Title:= _
"Spalte?", xpos:="6250", ypos:="4200")
If M = "" Then GoTo nix
Application.ScreenUpdating = False
For lngRow = Cells(Rows.Count, 1).End(xlUp).Row To 3 Step -1
If Cells(lngRow, M).Value.Links(1) Cells(lngRow - 1, M).Value.Links(1) And _
Not IsEmpty(Cells(lngRow, M)) And Not IsEmpty(Cells(lngRow - 1, M)) Then _
Rows(lngRow).Insert Shift:=xlShiftDown
Next
Application.ScreenUpdating = True
nix:
End Sub
Kann mir jemand den Code richtig schreiben? Danke im Voraus!Schönen Gruß
Burghard