Hi Guys,
It's been some time since writing but none the less I hope it's a sign that I'm actually improving a little! Anyhow, I just want sort something out relating to this thread. I've created a button in the right click pop up menu you get when you select a cell in excel to paste transpose (for example). I'm working in one sheet but with two windows. I tranpose the data I have highlighted and copied into the second window. However the position in the first window jumps to where I am pasting in the second window! This is a little annoying and so I'd like to know if there is some extra code which would prevent this?
Alternatively, I could use a second workbook but that's sidelining the problem and i'd like to continue to learn about VBA.
Thanks very much in advance!
Rod
Below is the code I'm using (Thanks to JustinEzequiel for the help!)
--------------
Option Explicit
Sub AddButton()
Dim oButton As CommandBarButton
Set oButton = CommandBars("Cell").Controls.Add(msoControlButton, , , , True)
With oButton
.Caption = "Paste Transpose"
.DescriptionText = "Paste transpose"
.Enabled = True
.OnAction = "Paste_transpose"
.TooltipText = "See module in Personal.xls"
.Visible = True
End With
End Sub
Sub Paste_transpose()
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
, Transpose:=True
End Sub