Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Odd copy and paste question

The logic here sounds so simple to me but I can not get the code to work so I
could use some help. I am in Excel 2000 and I am dealing with 2 sheets in
the same workbook. On sheet one I have a column of words (like in Cells A1
to A10) and I need to set up some kind of macro loop that will grab the info
from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell A2
from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a column
and pasting it into a row I can not just grab the range. I have to get them
one at a time.
Here is something a Little better to show what I am talking about

Sheet1 | Sheet2
(Cell)A | CellA Cell B
Cell C
1 Test | Test Desk
House
2 Desk |
3 House |
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Odd copy and paste question

Are you simply looking to transpose the data onto sheet2, like so. I have
used sheet1 and sheet2, change to suit

Sub TransposeData()
Dim wks As Worksheet
Set wks = Worksheets("Sheet2")
Worksheets("Sheet1").Range("A1:A10").Copy
wks.Range("C2").PasteSpecial Transpose:=True
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"ElkySS" wrote in message
...
The logic here sounds so simple to me but I can not get the code to work
so I
could use some help. I am in Excel 2000 and I am dealing with 2 sheets in
the same workbook. On sheet one I have a column of words (like in Cells
A1
to A10) and I need to set up some kind of macro loop that will grab the
info
from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell A2
from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a
column
and pasting it into a row I can not just grab the range. I have to get
them
one at a time.
Here is something a Little better to show what I am talking about

Sheet1 | Sheet2
(Cell)A | CellA Cell B
Cell C
1 Test | Test Desk
House
2 Desk |
3 House |


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Odd copy and paste question

worksheets("Sheet1").Range("A1:A10").copy
Worksheets("Sheet2").Range("C2").PasteSpecial _
Paste:=xlPasteAll, Transpose:=True

--
Regards,
Tom Ogilvy


"ElkySS" wrote in message
...
The logic here sounds so simple to me but I can not get the code to work
so I
could use some help. I am in Excel 2000 and I am dealing with 2 sheets in
the same workbook. On sheet one I have a column of words (like in Cells
A1
to A10) and I need to set up some kind of macro loop that will grab the
info
from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell A2
from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a
column
and pasting it into a row I can not just grab the range. I have to get
them
one at a time.
Here is something a Little better to show what I am talking about

Sheet1 | Sheet2
(Cell)A | CellA Cell B
Cell C
1 Test | Test Desk
House
2 Desk |
3 House |



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Odd copy and paste question

That did exactly what I needed it to do... as soon as I ran it I realized
that there is another part to the exuasion. on Sheet2 every other column is
hidded. When it paste the data in from Sheet1 it is even putting it in the
hidden cells. Is there a way to make it only write to the visiable cells or
to have it step over every other column. I can see columns like C E G I K
but it is pasting it in at every cell like C D E F G so it only shows 1/2 of
the names.
BTW Thanks a lot. I am not sure why that was kicking my butt as much as it
was.

"Nick Hodge" wrote:

Are you simply looking to transpose the data onto sheet2, like so. I have
used sheet1 and sheet2, change to suit

Sub TransposeData()
Dim wks As Worksheet
Set wks = Worksheets("Sheet2")
Worksheets("Sheet1").Range("A1:A10").Copy
wks.Range("C2").PasteSpecial Transpose:=True
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"ElkySS" wrote in message
...
The logic here sounds so simple to me but I can not get the code to work
so I
could use some help. I am in Excel 2000 and I am dealing with 2 sheets in
the same workbook. On sheet one I have a column of words (like in Cells
A1
to A10) and I need to set up some kind of macro loop that will grab the
info
from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell A2
from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a
column
and pasting it into a row I can not just grab the range. I have to get
them
one at a time.
Here is something a Little better to show what I am talking about

Sheet1 | Sheet2
(Cell)A | CellA Cell B
Cell C
1 Test | Test Desk
House
2 Desk |
3 House |


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Odd copy and paste question

Sub abc()
Dim cell As Range
For Each cell In Worksheets("Sheet1" _
).Range("A1:A10")
cell.Copy Worksheets("Sheet2").Range( _
"C2").Offset(2, (cell.Row - 1) * 2)
Next

End Sub

--
Regards,
Tom Ogilvy



"ElkySS" wrote in message
...
That did exactly what I needed it to do... as soon as I ran it I realized
that there is another part to the exuasion. on Sheet2 every other column
is
hidded. When it paste the data in from Sheet1 it is even putting it in
the
hidden cells. Is there a way to make it only write to the visiable cells
or
to have it step over every other column. I can see columns like C E G I K
but it is pasting it in at every cell like C D E F G so it only shows 1/2
of
the names.
BTW Thanks a lot. I am not sure why that was kicking my butt as much as
it
was.

"Nick Hodge" wrote:

Are you simply looking to transpose the data onto sheet2, like so. I have
used sheet1 and sheet2, change to suit

Sub TransposeData()
Dim wks As Worksheet
Set wks = Worksheets("Sheet2")
Worksheets("Sheet1").Range("A1:A10").Copy
wks.Range("C2").PasteSpecial Transpose:=True
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"ElkySS" wrote in message
...
The logic here sounds so simple to me but I can not get the code to
work
so I
could use some help. I am in Excel 2000 and I am dealing with 2 sheets
in
the same workbook. On sheet one I have a column of words (like in
Cells
A1
to A10) and I need to set up some kind of macro loop that will grab the
info
from cell A1 on Sheet1 and copy it to Cell C2 on Sheet2 then grap Cell
A2
from Sheet1 and put in in Cell D2 on Sheet2. because I am copying a
column
and pasting it into a row I can not just grab the range. I have to get
them
one at a time.
Here is something a Little better to show what I am talking about

Sheet1 | Sheet2
(Cell)A | CellA Cell B
Cell C
1 Test | Test Desk
House
2 Desk |
3 House |




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 Question stew Excel Discussion (Misc queries) 12 November 9th 08 07:45 PM
Copy/Paste Question DoubleZ Excel Discussion (Misc queries) 3 September 24th 08 11:13 PM
Copy/Paste question Dan Excel Worksheet Functions 0 February 22nd 07 12:55 AM
Tricky copy/paste question cooldyood[_9_] Excel Programming 0 August 10th 06 09:13 PM
Copy Paste Question lcannon Excel Discussion (Misc queries) 1 June 14th 05 12:48 AM


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