Link to home
Start Free TrialLog in
Avatar of BlakeISS
BlakeISS

asked on

Creating a script and need to generate from 4 columns in Excel

I have 4 columns of data and would like to convert them on the next sheet to row 1,2,3,4..

line1   |  line 2|  line3  | line4  

would like to make it....

line1
line2
line3
line4
Avatar of Makrini
Makrini
Flag of Australia image

Sub Macro1()

    Sheets("Sheet1").Range("A1:D1").Copy
    Sheets("Sheet2").Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Application.CutCopyMode = False
End Sub

Open in new window

Avatar of BlakeISS
BlakeISS

ASKER

When I run this macro, it does only the first record. How do I make it run for all the records?
1:
2:
3:
4:
5:
6:
7:
 Sub Macro1()

    Sheets("Sheet1").Range("A1:D1").Copy
    Sheets("Sheet2").Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Application.CutCopyMode = False
End Sub

Open in new window

Where is your data, and where you you want it?

is it

row 1 - 1,2,3,4
row 2 - 5,6,7,8

and going to
1,5
2,6
3,7
4,8

or
1
2
3
4
5
6
7
8
Sub Macro1()  
 Lastrow = Sheets("Sheet1").range("A" & rows.count).end(xlup).row
for i = 0 to lastrow - 1
    Sheets("Sheet1").Range("A1:D1").offset(i,0).Copy  
    Sheets("Sheet2").Range("A1").offset(0,i).PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _  
        False, Transpose:=True  
    Application.CutCopyMode = False
next i
End Sub

Open in new window

in sheet1
columns are  colunm1: are link special mailboxes desktop t2test14 mailbox column2 put properties "mailboxes:mailbox" 1016 6 0 1321 6 0      column3rename "mailboxes:mailbox" "t2test14s mailbox"       column4 ###


I would like to output to sheet2 to be
row1
row2
row3
row4

link special mailboxes desktop t2test14 mailbox
put properties "mailboxes:mailbox" 1016 6 0 1321 6 0
rename "mailboxes:mailbox" "t2test14s mailbox"
###
I have 1400 records to do this with...
Maybe if you provide an example workbook showing from data on one sheet and to data on second sheet
Here is a sample
Book1.xls
In sheet 2 do you want the next row of data into column B?
SOLUTION
Avatar of Makrini
Makrini
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok this macro created them horizontally and did not put them into a list.
It did however, try to do the entire list.

1:
2:
3:
4:
5:
6:
7:
8:
9:
 Sub Macro1()
 lastrow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
For i = 0 To lastrow - 1
    Sheets("Sheet1").Range("A1:D1").Offset(i, 0).Copy
    Sheets("Sheet2").Range("A1").Offset(0, i).PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Application.CutCopyMode = False
Next i
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial