Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VBA EXCEL Problem mit Zeile kopieren

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich habe folgenden VBA-Code um Daten aus einer Listenbox in ein Tabellenblatt zu kopieren.

Public Sub Hinzufuegen()

Dim iCounter, xCounter, z, lzeile As Long

Set wkb1 = ThisWorkbook

Set wks = wkb1.Worksheets("Favoriten")

wkb1.Activate

z = wks.Range("A65536").End(xlUp).Row + 1

For iCounter = 0 To ListBox1.ListCount - 1

If ListBox1.Selected(iCounter) And xOpt = 1 Or xOpt = 2 Then

Set XBlatt = Sheets(ListBox1.List(iCounter, 0))

XZeile = Range(ListBox1.List(iCounter, 1)).Row

xCounter = xCounter + 1

XBlatt.Rows(XZeile).Copy wks.Cells(z, 2).Rows(xCounter)

'Status einfügen

wks.Cells(z, 21).Rows(xCounter).Value = ("OK")

wks.Cells(z, 21).Rows(xCounter).HorizontalAlignment = xlCenter

wks.Cells(z, 21).Rows(xCounter).Interior.ColorIndex = 43

End If

Next iCounter

End Sub

In der folgenden Zeile wird eine ganze Zeile von einem Tabellenblatt in ein anderes kopiert.

XBlatt.Rows(XZeile).Copy wks.Cells(z, 1).Rows(xCounter)

Dabei wird natürlich in Saplte A eingefügt. Aber ich möchte die esrte Saplte frei halten um den Satus einzufügen. Ich kann leider keine 2 als Saplte benennen, da dann der Bereich zum einfügen kleiner ist als der kopierende Bereich. Ist es irgendwie möglich, dass ich nur die halbe Zeile kopiere und dann bei Saplte B einfüge. Oder hat vielleicht jemand einen ganz anderen Vorschlag.

Bin über jede Hilfe sehr dankbar.

  • 2 Wochen später...

hi Rainman1981,

ich denke das sollte dir helfen:

Range(ActiveCell.Address & ":AA" & Split(ActiveCell,"$")(2)).Select

Selection.Copy

usw...

denke das sollte gehen, markiert in dem Bsp. eben bis zur Spalte AA der aktuellen Zeile, ist aber ungetestet.

mfg

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.