View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
T-容x[_38_] T-容x[_38_] is offline
external usenet poster
 
Posts: 1
Default Write Data from Sheet1 to sheet2 Until


Hi Maperalia! I'm not very sure about your problem, but, maybe thi
excercise will give you ideas...

I'm assuming Sheet1 is where you type in your data and Sheet2 is wher
you get the "transposed" results.

In Sheet1 (VBA editor), put this code:

Private Sub Worksheet_Change(ByVal Target As Range)
Sheet2.Cells(Target.Column, Target.Row) = Target.Value
End Sub

The code above will transpose the data to Sheet2.

If you enter in Sheet1:
A1 - "hello"
B1 - "world"
C1 - "hello"
D1 - "vba"

Sheet2 will have:
A1 - "hello"
A2 - "world"
A3 - "hello"
A4 - "vba"

But, (the side-effect) if you enter in Sheet1:
A1 - "hello"
A2 - "world"
A3 - "hello"
A4 - "vba"

Sheet2 will have:
A1 - "hello"
B1 - "world"
C1 - "hello"
D1 - "vba"



maperalia Wrote:
How the code will be written if the data from sheet1 is located in the
following cells:
A1
B1
C1
D1
Then I want this data to written in the following cells of the sheet2:
A1,A2,A3,A4

Thanks in advance....

Maperalia



i
"PY & Associates" wrote:

You did not indicate where to copy to. Meanwhile, how is this?

Range(ActiveCell, ActiveCell.End(xlDown)).EntireRow.copy
sheets(2).range("....)
YOu do not need looping


"cunning" wrote:


How would I go about coding a Loop to read rows of data from Sheet

then
write the data to Sheet2 until an empty row is encountered?

Thanks for any assistance.


--
cunning


------------------------------------------------------------------------
cunning's Profile

http://www.excelforum.com/member.php...o&userid=26738
View this thread

http://www.excelforum.com/showthread...hreadid=399965



--
T-容
-----------------------------------------------------------------------
T-容x's Profile: http://www.excelforum.com/member.php...fo&userid=2657
View this thread: http://www.excelforum.com/showthread.php?threadid=39996