alexanderd
Technical User
any one any ideas on how to split a colum of upto 10,000 rows into two halves so that the bottom halve can be selected and moved to another position or work sheet
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Range("A5001:A10000").copy Destination:=Range("B1")
Range("A5001:C10000").copy Destination:=Range("D1")
Sub SPLIT_COPY_PASTE()
'get in the habit of defining ROW variables as LONG _
since INTEGER only gives you 32767 and there are over 65000 rows in Excel
Dim LAST_ROW As Long
'if the used range does NOT begin in ROW 1, the former formula will give you and incorrect last row _
--consider a used range with data in rows 5 & 6 _
Rows.Count is 2. But Last row should be 2 + 5 - 1
With Sheets("sheet1").UsedRange
LAST_ROW = .Rows.Count + .Row - 1
End With
' (1) LAST_ROW / 2 gives the centre position of the column
' (2) (LAST_ROW / 2) + 1, 1) the + 1 is to make the colums equal in length
' (4) ( LAST_ROW , 3 ) the 3 represents the no. of Columns
' (5) Range ( "E5") is the position of the row for the 2nd part of the split range
Range(Cells(Int(LAST_ROW / 2) + 3, 1), Cells(LAST_ROW, 3)).Cut Destination:=Range("E5")
End Sub