View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
[email protected] balan_radu2003@yahoo.com is offline
external usenet poster
 
Posts: 9
Default macro from columns to rows but adding every time a new line

Hello

I would like to have a code that transforms 2 or more columns in rows.
The special thing here is that if I change the values in the same
columns and run again the macro the new values should apear under the
old lines.

Example:

Column1 - Column2
A --------------- X
B --------------- Y
C --------------- Z

When I run the macro I want that it apears in another place in the
same document same sheet like this:

Line 1 - A B C
Line 2 - X Y Z

If I run again the macro by not changing the data in the columns the
list should update by adding the same thing under the fist 2 lines -
like this:

Line 1 - A B C
Line 2 - X Y Z
Line 3 - A B C
Line 4 - X Y Z

If I change the data in the same Columns like this....

Column1 - Column2
D --------------- G
E --------------- H
F --------------- I

.....and then run again the macro the list should update again by
adding the 2 lines like this:

Line 1 - A B C
Line 2 - X Y Z
Line 3 - A B C
Line 4 - X Y Z
Line 5 - D E F
Line 6 - G H I


I already have some kind of codes that do something similar but I need
them combined somehow:

Fist code:

Sub RoundedRectangle1_Click()
a = 27

Do While Cells(a, 3).Value < ""
a = a + 1
Loop

Cells(a, 3).Value = Range("C26").Value
End Sub


Second code:

Sub Macro6()
Range("A1:B37").Select
Selection.Copy
Range("G8").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Range("G8").Select
End Sub

I would really appreciate your help

Thanks in advance