Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Move data from different columns into one column, but different rows.

Hello,
I am new to Excel and VB. I am trying to write a macro in VB to do th
following as shown in example.

Example:

I need to move (cut & paste ) the data from columns B through F int
column A. The data in Cell B1 would need to go into cell A11, data i
Cell B2 into cell A12 . . . B6 into cell A16, and then move data i
cell C1 into A17, C2 into cell A18 . . . and so on for the rest of th
columns. Shown below see existing positions of data and fina
position.

****NOTE***** The number of rows and number of columns changes on dail
basis with the data I am exporting from another database. So ther
might be columns out to " T " with different number of rows in eac
column.

Existing positions of data:

col col col col col
col
A B C D E
F

A1 B1 C1 D1 E1 F1
A2 B2 C2 D2 E2 F2
A3 B3 C3 D3 E3 F3
A4 B4 C4 D4 E4 F4
A5 B5 C5 D5 F5
A6 B6 C6 D6 F6
A7 C7 D7 F7
A8 C8 D8 F8
A9 D9 F9
A10 F10


Final positions of data after moved:

col
A

A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
B1
B2
B3
B4
B5
B6
C1
C2
C3
C4
C5
C6
C7
C8
D1
D2
D3
D4
D5
D6
D7
D8
D9
E1
E2
E4
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10

P.S. I had a similar task answered on another thread. The thread was
Move Different Columns of Data to Single Column. "

Thank you for any help.
Regards

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Move data from different columns into one column, but different rows.

Sub PutinColumnA()
Dim rng As Range
Dim rw As Long
Dim col As Range, cell1 As Range
Set rng = Range("B1").CurrentRegion
If rng.Columns(1).Column = 1 Then _
Set rng = rng.Offset(0, 1).Resize(, rng.Columns.Count - 1)
rw = 1
For Each col In rng.Columns
For Each cell1 In col.Cells
If Not IsEmpty(cell1) Then
Cells(rw, 1).Value = cell1.Value
rw = rw + 1
cell1.ClearContents
End If
Next
Next
End Sub
--
Regards,
Tom Ogilvy


"willik " wrote in message
...
Hello,
I am new to Excel and VB. I am trying to write a macro in VB to do the
following as shown in example.

Example:

I need to move (cut & paste ) the data from columns B through F into
column A. The data in Cell B1 would need to go into cell A11, data in
Cell B2 into cell A12 . . . B6 into cell A16, and then move data in
cell C1 into A17, C2 into cell A18 . . . and so on for the rest of the
columns. Shown below see existing positions of data and final
position.

****NOTE***** The number of rows and number of columns changes on daily
basis with the data I am exporting from another database. So there
might be columns out to " T " with different number of rows in each
column.

Existing positions of data:

col col col col col
col
A B C D E
F

A1 B1 C1 D1 E1 F1
A2 B2 C2 D2 E2 F2
A3 B3 C3 D3 E3 F3
A4 B4 C4 D4 E4 F4
A5 B5 C5 D5 F5
A6 B6 C6 D6 F6
A7 C7 D7 F7
A8 C8 D8 F8
A9 D9 F9
A10 F10


Final positions of data after moved:

col
A

A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
B1
B2
B3
B4
B5
B6
C1
C2
C3
C4
C5
C6
C7
C8
D1
D2
D3
D4
D5
D6
D7
D8
D9
E1
E2
E4
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10

P.S. I had a similar task answered on another thread. The thread was "
Move Different Columns of Data to Single Column. "

Thank you for any help.
Regards,


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Move data from different columns into one column, but different rows.

Tom,
Thank you. This worked perfectly.

Regards, (willik

--
Message posted from http://www.ExcelForum.com

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
move data from columns to rows bill gras Excel Worksheet Functions 3 November 21st 09 01:46 AM
How to move data from rows to columns How to move data from rows to columns Excel Discussion (Misc queries) 6 October 13th 09 10:16 AM
Mass move data in rows to columns. Brad W Excel Discussion (Misc queries) 3 November 26th 08 12:21 PM
name,address in same column different rows. How move to columns kimbafred Charts and Charting in Excel 8 July 20th 07 02:12 AM
Move Data from rows to columns... Dan B Excel Worksheet Functions 2 January 6th 06 04:47 PM


All times are GMT +1. The time now is 10:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"