宏代码(没有调试合并单元格情况,只能简单单列(行)转置):
Dim MyClip As New CClipboard
Sub Macro1()
Dim a() As String
Dim TempStr As String
TempStr = MyClip.GetText()
a() = Split(TempStr, Chr(13))
a() = Split(a(0), Chr(9))
Dim TempCol As Integer
Dim TempRow As Integer
TempCol = Selection.Column
TempRow = Selection.Row
For i = 0 To UBound(a())
Cells(TempRow + i * 2, TempCol) = a(i) '行转置成列
'Cells(TempRow, TempCol + i * 2) = a(i) '列转置成行
Next i
End Sub
需要添加类模块,类模块请在参考网页中下载
http://vb.mvps.org/samples/snatch.asp?id=ClipEx
晕,看来是没人能发现我这个函数的价值,这个函数的用法是,复制任一列(或行)或部分行,然后选一单元格,点这个函数绑定的按钮,就完成隔一单元格粘贴了,与选择性粘贴的功能类似.
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)