ich habe in Spalte A1: B30000 Inhalte.
Ich möchte die Werte aufteilen, aber nur bis Zeile 100.
Die Werte sollen also von A1:B100, von C1:D100, von E1:F100 etc. stehen
Weiß jemand wie man das mit VBA umsetzen kann?
Danke!
Sub SpalteA_und_B_ungruppieren_1()
'umgruppieren über Cut & Paste
Dim wks As Worksheet
Dim Zeile As Long, Spalte As Long, Zeile_L, StatusCalc As Long
Dim rngCopy As Range
Set wks = ActiveSheet
'Makrobremsen lösen
With Application
.ScreenUpdating = False
StatusCalc = .Calculation
.Calculation = xlCalculationManual
End With
With wks
Spalte = 1
Zeile_L = Application.WorksheetFunction.Max(.Cells(.Rows.Count, 1).End(xlUp).Row, _
.Cells(.Rows.Count, 2).End(xlUp).Row)
For Zeile = 101 To Zeile_L Step 100
Spalte = Spalte + 2
Set rngCopy = .Range(.Cells(Zeile, 1), .Cells(Zeile + 99, 2))
rngCopy.Cut Destination:=.Cells(1, Spalte)
Next Zeile
.Range("A1:B100").Copy
.Range(.Cells(1, 3), .Cells(100, Spalte + 1)).PasteSpecial Paste:=xlPasteColumnWidths
Application.CutCopyMode = False
End With
'makrobremsen zurücksetzen
With Application
.ScreenUpdating = True
.Calculation = StatusCalc
End With
End Sub
Sub Aufteilen_in_100_Zeilen()
Dim lngRow As Long, aryTmp(), aryZiel(), lngSpalte As Long, lngCol As Long
Dim lngMaxrow As Long
lngMaxrow = ActiveSheet.UsedRange.Rows.Count
aryTmp = Range("A1:B" & lngMaxrow)
lngSpalte = UBound(aryTmp) / 100
ReDim aryZiel(1 To 101, 1 To lngSpalte * 2 + 1)
For lngRow = 1 To 100
For lngCol = 1 To lngSpalte
Select Case lngCol
Case 1
aryZiel(lngRow, 1) = aryTmp(lngRow, 1) 'Spalte A
aryZiel(lngRow, 2) = aryTmp(lngRow, 2) 'Spalte B
Case Else
If lngRow + 100 * (lngCol - 1)
Gruß
Dim Zeile As Long
Dim Spalte As Long
Spalte = 3
For Zeile = 101 To 30000 Step 100
Cells(Zeile, 1).Resize(100, 2).Cut Destination:=Cells(1, Spalte)
Spalte = Spalte + 2
Next
als formel folgende Formel in C1:
=INDEX($A:$B;ZEILE()+100*(SPALTE(A1)+ISTUNGERADE(SPALTE(A1)))/2;1+ISTGERADE(SPALTE()))