本来想网上找一个的,没找到,只好自己写一个了给你们分享一下,代码写的很粗糙你们看看就好
Public Sub CommandButton1_Click()
Dim x, y, pvalue, tempy
x = Selection.Row()
y = Selection.Column()
pvalue = GetOffClipboard
arrx = Split(pvalue, Chr(13) + Chr(10))
For i = 0 To UBound(arrx)
If (ActiveSheet.Rows(x & ":" & x).Hidden = False) Then
arry = Split(arrx(i), Chr(9))
tempy = y
For j = 0 To UBound(arry)
If (ActiveSheet.Columns(Chr(65 + tempy - 1) & ":" & Chr(65 + tempy - 1)).Hidden = False) Then
Cells(x, tempy) = arry(j)
Else
j = j - 1
End If
tempy = tempy + 1
Next j
Else
i = i - 1
End If
x = x + 1
Next i
End Sub
Public Function GetOffClipboard() As Variant
Dim MyDataObj As New DataObject
MyDataObj.GetFromClipboard
GetOffClipboard = MyDataObj.GetText()
End Function
加个精吧
Public Sub CommandButton1_Click()
Dim x, y, pvalue, tempy
x = Selection.Row()
y = Selection.Column()
pvalue = GetOffClipboard
arrx = Split(pvalue, Chr(13) + Chr(10))
For i = 0 To UBound(arrx)
If (ActiveSheet.Rows(x & ":" & x).Hidden = False) Then
arry = Split(arrx(i), Chr(9))
tempy = y
For j = 0 To UBound(arry)
If (ActiveSheet.Columns(Chr(65 + tempy - 1) & ":" & Chr(65 + tempy - 1)).Hidden = False) Then
Cells(x, tempy) = arry(j)
Else
j = j - 1
End If
tempy = tempy + 1
Next j
Else
i = i - 1
End If
x = x + 1
Next i
End Sub
Public Function GetOffClipboard() As Variant
Dim MyDataObj As New DataObject
MyDataObj.GetFromClipboard
GetOffClipboard = MyDataObj.GetText()
End Function
加个精吧

