ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for one-click paste special transpose (https://www.excelbanter.com/excel-programming/340882-macro-one-click-paste-special-transpose.html)

Victoria @ WB

Macro for one-click paste special transpose
 
I would like to write a macro to assign to a toolbar button. I would like it
to Paste_Special Transpose in the active cell.

Seems simple enough, but I keep failing.

Thanks for any help.

Dave Peterson

Macro for one-click paste special transpose
 
Maybe...

Option Explicit
Sub testme()

On Error Resume Next
ActiveCell.PasteSpecial Transpose:=True
If Err.Number < 0 Then
MsgBox "Something bad happened!"
Err.Clear
End If
On Error GoTo 0

End Sub

Lots of things can go wrong--nothing currently copied, the paste won't fit, ...

So I just let it fail and issue a warning.



Victoria @ WB wrote:

I would like to write a macro to assign to a toolbar button. I would like it
to Paste_Special Transpose in the active cell.

Seems simple enough, but I keep failing.

Thanks for any help.


--

Dave Peterson

Victoria @ WB

Macro for one-click paste special transpose
 
It worked. Thanks.

"Dave Peterson" wrote:

Maybe...

Option Explicit
Sub testme()

On Error Resume Next
ActiveCell.PasteSpecial Transpose:=True
If Err.Number < 0 Then
MsgBox "Something bad happened!"
Err.Clear
End If
On Error GoTo 0

End Sub

Lots of things can go wrong--nothing currently copied, the paste won't fit, ...

So I just let it fail and issue a warning.



Dave Peterson

Macro for one-click paste special transpose
 
You're welcome.

Victoria @ WB wrote:

It worked. Thanks.

"Dave Peterson" wrote:

Maybe...

Option Explicit
Sub testme()

On Error Resume Next
ActiveCell.PasteSpecial Transpose:=True
If Err.Number < 0 Then
MsgBox "Something bad happened!"
Err.Clear
End If
On Error GoTo 0

End Sub

Lots of things can go wrong--nothing currently copied, the paste won't fit, ...

So I just let it fail and issue a warning.


--

Dave Peterson


All times are GMT +1. The time now is 11:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com