create keyboard shortcut

K

kalvarado

I want to create a keyboard shortcut for the action "paste
special"-"transpose" and I do not know how to write a macro.

any suggestions?
 
F

Frank Kabel

Hi
try the following:
- copy some data
- start recording a macro (goto 'Tools - Macros - Record macro') and
assign a shortcut to this macro
- apply your Paste Special - Transpose
- stop the recording
 
A

Anne Troy

Hi, kalvarado. You can do this without a macro. Go to Tools-Customize,
Commands tab. Choose Edit on the left, and drag the Paste special up onto
your toolbar. Then, when you want to Paste special-Transpose, you can hit
Alt, p, e, enter.

Otherwise, I don't think we can have you record a macro, 'cause it'll want
to paste exactly what you've copied before recording. I don't know how to
help you edit that code. You could record the macro, then ask in
microsoft.public.excel.programming how to make the macro work on whatever is
currently on the clipboard (but provide the code you created during the
macro to help the coder know what you need). To record a macro (which is
sooo simple, it's ridiculous, and works for so many tasks):
http://www.theofficeexperts.com/officevba.htm#ExcelVBA

<-*-><-*-><-*-><-*-><-*-><-*-><-*-><-*->
Hope this helps!
Anne Troy (better known as Dreamboat)
Author: Dreamboat on Word
Email: Dreamboat*at*Piersontech.com
Web: www.TheOfficeExperts.com
<-*-><-*-><-*-><-*-><-*-><-*-><-*-><-*->
 
D

Dave Peterson

I recorded a macro when I did it manually and then tweaked it:

Option Explicit
Sub PasteSpecialTranspose()

If Application.CutCopyMode <> xlCopy Then
MsgBox "nothing was copied!"
Exit Sub
End If

On Error Resume Next
ActiveCell.PasteSpecial Paste:=xlPasteAll, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
If Err.Number <> 0 Then
MsgBox "Something bad happened!"
Err.Clear
End If
On Error GoTo 0

End Sub


Then under Tools|Macro|macros..., I clicked on PasteSpecialTranspose and then
clicked Options.

I assigned my favorite shortcut key to the macro.
 
Top