![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 251
|
Hi There,
I have a probelm. I am tring to paste data as Traspose. I have data arranged in columns. From Column A I want to take cell A15 value and plug it into next sheet, in column R, row 15. and one more thing, I don't know how many columns I'll have each time. Each time it should pick vale from A, B, c, etc,and paste it in Column R and row 15, 16, 17 etc. I try to use Dim A as long. But I don't now some thing wrong, I can't figure it out. Can you please help me out here. I shall be thankful to you. Thanks. |
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
You could try the following code:
Code:
Sub Trnsps()
Dim z As Integer
z = Sheets(1).Range("a15").End(xlToRight).Column
Sheet1.Range("a15:" & Cells(15, z).Address).Copy
Sheet2.[r15].PasteSpecial Transpose:=True
Application.Goto Sheet2.[r15] 'only because transposing selects without our permission
Application.CutCopyMode = False
End Sub
_________________ Cheers, NateO ![]() [ This Message was edited by: NateO on 2002-05-13 15:47 ] |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: May 2002
Posts: 251
|
Thanks alot man. You are pretty quick in response.
Thank you. |
|
|
|
|
|
#4 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
You're welcome Amna. You can use integer instead of long (although long would work) as there are only 256 columns and an integer can represent a number to 32,767.
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: May 2002
Posts: 251
|
Thanks for all your help.
Do you stay on line 24 hours, because you reply right away. Just kidding. This web site is so cool,and all the tips are helpful. Thanks again. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|