如何转换excel的10000行限制?

如何转换excel的10000行限制?,excel,transpose,Excel,Transpose,我试图转置所有列“B”,但想跳过一行,然后抓取下4个并将它们粘贴到同一列中。 如何使此循环每5行跳过一次列“B”,并将范围自动更改为下一个开放单元格或“范围”,而无需手动分别键入每个单元格 Range("B12:B16").Select Selection.Copy Sheets("Sheet2").Select Range("A2").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNo

我试图转置所有列“B”,但想跳过一行,然后抓取下4个并将它们粘贴到同一列中。 如何使此循环每5行跳过一次列“B”,并将范围自动更改为下一个开放单元格或“范围”,而无需手动分别键入每个单元格

Range("B12:B16").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("A2").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Range("B18:B22").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("A3").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Range("B24:B28").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("A4").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True

您可以尝试此代码,我已经在Excel 2010上对超过10k个单元格进行了测试:

Sub SkipOnFive()

Dim inRow As Integer 'number of row in source worksheet
Dim outRow As Integer 'number of row in output worksheet
Dim outCol As Integer 'number of column in output worksheet

Dim strTemp As String

inRow = 1 'this is your start row on input sheet
outRow = 1 ' this is your start row on output sheet

Do
    For outCol = 1 To 4
        strTemp = Cells(inRow, 2).Value
        Worksheets(2).Cells(outRow, outCol).Value = strTemp
       inRow = inRow + 1
    Next
    outRow = outRow + 1
    inRow = inRow + 1
Loop While strTemp <> vbNullString 'vbnullstring is kind of empty string, but it does not use any resources to create
End Sub
Sub-SkipOnFive()
Dim inRow As Integer“源工作表中的行数
Dim outRow作为整数“输出工作表中的行数
Dim outCol作为整数“输出工作表中的列数
将strTemp设置为字符串
inRow=1'这是输入表上的起始行
outRow=1'这是输出表上的起始行
做
对于outCol=1到4
strTemp=单元格(inRow,2).值
工作表(2).单元格(outRow,outCol).值=strTemp
inRow=inRow+1
下一个
outRow=outRow+1
inRow=inRow+1
循环,而strTemp vbNullString的vbNullString是一种空字符串,但它不使用任何资源来创建
端接头

在专门使用Excel等软件的网站上,这个问题可能会得到更好的答案。如果您正在寻找VBA解决方案,我相信stackoverflow.com也可以:)