Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Select All,Copy All and Paste Special Question

You cannot copy paste special values and transpose on the same area.

I suggest one solution as follows:

insert a temp worksheet
cut the original area
paste special values on the new temp sheet
copy the pasted values
paste special transpose on the original worksheet
delete the temp worksheet

as in

Option Explicit

Sub copypastespecialvaluestranspose()

Dim wso As Worksheet, _
wst As Worksheet
Dim R As Range
Set wso = ActiveSheet
Set wst = ActiveWorkbook.Worksheets.Add
wso.Activate
'szR = Selection.Cells(1, 1).Address
Set R = Selection.Cells(1, 1)
Selection.Copy
wst.Activate
wst.Cells(1, 1).PasteSpecial _
xlPasteValuesAndNumberFormats, , , True
wso.Activate
Selection.Clear
R.Select
wst.UsedRange.Copy R
Application.DisplayAlerts = False
wst.Delete
Application.DisplayAlerts = True
Application.CutCopyMode = False
End Sub

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"swaroop" wrote:

Hi All,
I have a set of values in worksheet.
I want to transpose the data in the worksheet.
I want to copy all cells and Paste Special on top of the existing cells with
the trasposed data.
How can i copy all the cells in worksheet and then use Paste Special.

Any pointers are greatly appreciated.

Thanks,
Swaroop

P.S: I tried copying a range of cells and worksheet and when i try to paste
the cells by giving a Range , i get an COMException ,that copy and paste
areas should be the same.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select All,Copy All and Paste Special Question

Thanks all for responses.
psuedo code for what i have done is as follows.

a. Selected Range as i know the number of rows and columns.
b. Copied the data from Range.
c. Pasted the data into another region of worksheet with Transponse
d. Delete the Original data.

Let me know if this is a optimal solution.

"Martin Fishlock" wrote:

You cannot copy paste special values and transpose on the same area.

I suggest one solution as follows:

insert a temp worksheet
cut the original area
paste special values on the new temp sheet
copy the pasted values
paste special transpose on the original worksheet
delete the temp worksheet

as in

Option Explicit

Sub copypastespecialvaluestranspose()

Dim wso As Worksheet, _
wst As Worksheet
Dim R As Range
Set wso = ActiveSheet
Set wst = ActiveWorkbook.Worksheets.Add
wso.Activate
'szR = Selection.Cells(1, 1).Address
Set R = Selection.Cells(1, 1)
Selection.Copy
wst.Activate
wst.Cells(1, 1).PasteSpecial _
xlPasteValuesAndNumberFormats, , , True
wso.Activate
Selection.Clear
R.Select
wst.UsedRange.Copy R
Application.DisplayAlerts = False
wst.Delete
Application.DisplayAlerts = True
Application.CutCopyMode = False
End Sub

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"swaroop" wrote:

Hi All,
I have a set of values in worksheet.
I want to transpose the data in the worksheet.
I want to copy all cells and Paste Special on top of the existing cells with
the trasposed data.
How can i copy all the cells in worksheet and then use Paste Special.

Any pointers are greatly appreciated.

Thanks,
Swaroop

P.S: I tried copying a range of cells and worksheet and when i try to paste
the cells by giving a Range , i get an COMException ,that copy and paste
areas should be the same.

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
copy and paste special question tweacle Excel Worksheet Functions 3 January 5th 07 11:24 PM
Select All,Copy All and Paste Special Question Alok Excel Programming 0 January 3rd 07 12:31 AM
Select All,Copy All and Paste Special Question JLGWhiz Excel Programming 0 January 3rd 07 12:28 AM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM
Select Range every 20 rows copy & paste special Adam Excel Programming 1 June 22nd 04 11:43 PM


All times are GMT +1. The time now is 11:34 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"