View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Coding to make a transpose values button

Hi Sally,

JSeven's code worked for me, providing I removed line wraps:

'=============
Public Sub Sally()
Selection.PasteSpecial _
Paste:=xlValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=True
End Sub
'<<=============

Using your sequence:

so that after I have selected the data and done a control c
(for copy) I can select a cell where the data needs to be input
and press the button


I experienced no problems.

---
Regards,
Norman



"Sally" wrote in message
ups.com...
Thanks for replying,

I know it sounds like a plain request but when I pasted the line of
code into the VB Editor, selected data in the range A4:A11, press ctrl
c selected cell D4 and ran the macro I got the following error
message...

Run-time erro '1004':

PasteSpecial method of Range class failed

I do alot of data entry work and often need to transpose values.

Generally I would copy the row of data and go into paste special in the
edit menu and select values and transpose.

What I would like is to have a button on the tool bar so that after I
have selected the data and done a control c (for copy) I can select a
cell where the data needs to be input and press the button instead of
having to navigate through the menus.

I hope that makes sense, let me know if you need further info.

Thanks for your time!


jseven wrote:
That's a "plain" request. So I recorded my actions and here you go...

sub Sally()
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
end sub

Sally wrote:
Hi,
Can anyone send me some code so I can attach it to a button in the tool
bar that will transpose and paste values?

Thanks Sally