Finde Antworten, stelle Fragen und schließe dich mit unserer Community zusammen.

Startseite Forums Excel VBA Code Snippets Test 123

  • Test 123

    Posted by Excel Community on 6. Februar 2025 at 13:25

    Hey hier gibts Code:


    Sub Einfuegen_nur_sichtbar()
    Application.ScreenUpdating = False
    'Zwischenablage überprüfen
    If Not ClipboardHasData() Then
    MsgBox "Die Zwischenablage ist leer.", vbExclamation
    Exit Sub
    End If
    Dim clipboardData As New MSForms.DataObject
    Dim splitData As Variant
    Dim targetRow As Long
    Dim targetColumn As Long
    Dim lastRow As Long
    'Zwischenablage auslesen
    clipboardData.GetFromClipboard
    splitData = Split(clipboardData.GetText, vbCrLf)
    'Aktuelle Zeile und Spalte
    targetRow = Selection.Row
    targetColumn = Selection.Column
    'Letzte Zeile
    lastRow = GetLastRow(ActiveSheet, 1)
    Dim i As Long
    Dim n As Long
    Dim x As Long
    n = 0
    x = 0
    'Werte aus Zwischenablage in die sichtbaren Zeilen einfügen
    For i = targetRow To lastRow
    If Not Rows(i).EntireRow.Hidden Then
    Cells(targetRow, targetColumn).Value = splitData(x)
    x = x + 1
    End If
    'n = n + 1
    Next i
    Application.ScreenUpdating = True
    End Sub

    Danke 😀

    Hier nochmal was


    Sub Einfuegen_nur_sichtbar()
    Application.ScreenUpdating = False
    'Zwischenablage überprüfen
    If Not ClipboardHasData() Then
    MsgBox "Die Zwischenablage ist leer.", vbExclamation
    Exit Sub
    End If
    Dim clipboardData As New MSForms.DataObject
    Dim splitData As Variant
    Dim targetRow As Long
    Dim targetColumn As Long
    Dim lastRow As Long
    'Zwischenablage auslesen
    clipboardData.GetFromClipboard
    splitData = Split(clipboardData.GetText, vbCrLf)
    'Aktuelle Zeile und Spalte
    targetRow = Selection.Row
    targetColumn = Selection.Column
    'Letzte Zeile
    lastRow = GetLastRow(ActiveSheet, 1)
    Dim i As Long
    Dim n As Long
    Dim x As Long
    n = 0
    x = 0
    'Werte aus Zwischenablage in die sichtbaren Zeilen einfügen
    For i = targetRow To lastRow
    If Not Rows(i).EntireRow.Hidden Then
    Cells(targetRow, targetColumn).Value = splitData(x)
    x = x + 1
    End If
    'n = n + 1
    Next i
    Application.ScreenUpdating = True
    End Sub

    Excel Community replied 2 weeks aktiv. 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Log in to reply.