Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro - paste special (transpose)

He hi,

It's been a while since I used VBA so the following might contain a very
obvious error. I'd be very grateful if somebody could tell me what I do wrong
in my code:

Private Sub transpose()
Worksheets("Sheet1").Copy
Worksheets("Sheet2").PasteSpecial (transpose)
End Sub

I wrote this to make sure whole of sheet 1 is pasted in a transposed manner
(thus columns become rows and other way around) into sheet 2. For in sheet 1
I enter new data, but to make sorting (I've only figured out how to do that
by column) easier it has to be transposed before I do calculations with it.
Doing this by hand means copying all of sheet 1 and use "paste special" and
tick "transpose" to paste it in sheet 2.

I'm not sure if it's right to write a private sub for this... or whether
this code is the right one... Or wether I should write a loop like "copy row
1 and paste in column A"

Greetz, Robin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default macro - paste special (transpose)

Sub Macro1()
Sheets("Sheet1").Select
Rows("1:256").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Rows("1:256").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
End Sub

--
Gary''s Student - gsnu200826
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default macro - paste special (transpose)

Thx :)

"Gary''s Student" wrote:

Sub Macro1()
Sheets("Sheet1").Select
Rows("1:256").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Rows("1:256").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
End Sub

--
Gary''s Student - gsnu200826

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default macro - paste special (transpose)

Thank you, but for some reason "record macro" was unavailable - it was light
grey. I thought it wasn't allowed on the office computer I'm working on (no
idea for what reason when VBA is allowed :S ).
After closing and restarting the excel sheet I was allowed to record though.
So thanks for your help - it made me try again :D.

"Don Guillett" wrote:


Try recording to see what you did wrong

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"paste special, macro, transpose" <paste special, macro,
wrote in message
...
He hi,

It's been a while since I used VBA so the following might contain a very
obvious error. I'd be very grateful if somebody could tell me what I do
wrong
in my code:

Private Sub transpose()
Worksheets("Sheet1").Copy
Worksheets("Sheet2").PasteSpecial (transpose)
End Sub

I wrote this to make sure whole of sheet 1 is pasted in a transposed
manner
(thus columns become rows and other way around) into sheet 2. For in sheet
1
I enter new data, but to make sorting (I've only figured out how to do
that
by column) easier it has to be transposed before I do calculations with
it.
Doing this by hand means copying all of sheet 1 and use "paste special"
and
tick "transpose" to paste it in sheet 2.

I'm not sure if it's right to write a private sub for this... or whether
this code is the right one... Or wether I should write a loop like "copy
row
1 and paste in column A"

Greetz, Robin





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default macro - paste special (transpose)

Private Sub transpose()
Worksheets("Sheet1").range("a1:a21").Copy
Worksheets("Sheet2").range("a1").PasteSpecial _
Paste:=xlPasteAll, Transpose:=True


End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"paste special, macro, transpose"
. com wrote in message
...
Thank you, but for some reason "record macro" was unavailable - it was
light
grey. I thought it wasn't allowed on the office computer I'm working on
(no
idea for what reason when VBA is allowed :S ).
After closing and restarting the excel sheet I was allowed to record
though.
So thanks for your help - it made me try again :D.

"Don Guillett" wrote:


Try recording to see what you did wrong

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"paste special, macro, transpose" <paste special, macro,
wrote in message
...
He hi,

It's been a while since I used VBA so the following might contain a
very
obvious error. I'd be very grateful if somebody could tell me what I do
wrong
in my code:

Private Sub transpose()
Worksheets("Sheet1").Copy
Worksheets("Sheet2").PasteSpecial (transpose)
End Sub

I wrote this to make sure whole of sheet 1 is pasted in a transposed
manner
(thus columns become rows and other way around) into sheet 2. For in
sheet
1
I enter new data, but to make sorting (I've only figured out how to do
that
by column) easier it has to be transposed before I do calculations with
it.
Doing this by hand means copying all of sheet 1 and use "paste special"
and
tick "transpose" to paste it in sheet 2.

I'm not sure if it's right to write a private sub for this... or
whether
this code is the right one... Or wether I should write a loop like
"copy
row
1 and paste in column A"

Greetz, Robin




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste special transpose macro hhwar Excel Programming 2 February 21st 08 02:40 PM
Transpose, Paste Special idgity Excel Discussion (Misc queries) 2 September 6th 07 06:04 PM
how to create a copy/paste special/transpose macro? [email protected] Excel Discussion (Misc queries) 6 August 8th 07 06:07 AM
Paste Special / transpose Ron Carr Excel Discussion (Misc queries) 2 February 24th 06 06:13 PM
Macro for one-click paste special transpose Victoria @ WB Excel Programming 3 September 23rd 05 01:43 AM


All times are GMT +1. The time now is 01:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"