Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Data formatting

18 views
Skip to first unread message

AAZIM YOUSUF

unread,
Jun 27, 2022, 1:18:47 AM6/27/22
to
Hi,
I need help regarding how I can copy the data from different columns having some cells with no data into a single column ignoring the empty cells.

AAZIM YOUSUF

unread,
Jun 27, 2022, 1:30:16 AM6/27/22
to
On Monday, June 27, 2022 at 10:48:47 AM UTC+5:30, AAZIM YOUSUF wrote:
> Hi,
> I need help regarding how I can copy the data from different columns having some cells with no data into a single column ignoring the empty cells.
jan feb mar apr may jun jul aug sep oct nov dec
11.1 13.5 14.3 14.9 20.1 30.6 24.8 28 29 24.8 17.9 14.1
10.7 7.1 13.7 9.4 22.8 31.5 28.3 27.7 22.9 25.5 19.4 12.8
10.7 4.9 15.6 17.2 25.8 32.5 26 29.5 27 20.7 21.5 14.1
11.4 4.2 16.9 15.8 27.6 30.4 30.1 33.1 26.5 22.2 20.3 14.4
0 3.9 17.4 13.3 27 28.7 30 32.4 29.6 24.6 19.8 13.9
5.4 7.8 16.1 17.5 27.7 28.4 31.6 31 29.1 25.5 18.5 10.5
7.5 4.1 17.1 0 29.4 29.6 28.6 29.7 22.1 24.8 17.7 12.8
6.2 5.7 17.8 14.3 22.3 31.8 28.7 32.3 19.4 24.8 15.5 11.1
4.5 3.9 16.2 9.8 23.7 32.2 26.8 30.4 20.2 24 13.4 13.1
8.9 13.5 18.4 16.9 24.1 31.8 19.1 31.6 24.5 22.9 13.7 9.4
8.2 7.1 19.2 18.3 24.3 24.9 26.8 30.9 27.7 24.5 14.5 5.7
4.5 4.9 17.3 21.5 21.6 24.8 27.3 27.5 29.2 25.8 15.7 10.5
5.8 4.2 17.3 23.1 23.3 28.8 27.5 30.6 29.2 25.1 12.4 9
9.3 3.9 15.5 23.9 25.5 31.1 28.4 26.8 28.3 24.5 15.6 4.5
5.4 7.8 14.5 23.5 21.9 31.6 31.2 29.5 22.7 26.7 14.6 10.6
5.7 4.1 14.4 23.2 14.5 33.3 29.2 31.3 27.7 24 12.5 10.7
7.1 5.7 14.2 19.7 21.5 32.3 30.2 27.7 28.9 26.4 13.9 10.5
2.5 3.9 9.6 21 25 26.2 27.3 29.9 29.3 26.7 15.3 7.5
4 2.4 13.7 20.5 26.7 26.7 29.4 31.4 23.2 27.1 13.9 8.7
9.2 3.5 14.2 19.1 25.1 29.5 28.3 30.2 24.2 27.7 10.7 8.8
7.3 7.5 16.3 0 22.7 28.9 28.3 29.7 24.4 27.1 5.9 9.7
7.7 8.5 19.5 13.9 27.6 30.6 26.2 31.7 25.1 23.3 4.4 8
8.8 9 20.9 19.9 28.2 30.8 30.3 31.7 25.1 23.4 7.9 10.1
8.4 7.1 22.9 24.2 30.7 31.6 29.8 29.6 22.3 22.8 10.6 10.4
7.3 9.7 22.8 26.3 31.7 32.2 28.5 30.4 23.6 22.7 11.1 8.6
7.8 2.7 0 24.7 32.8 31.8 30.5 28.7 25.5 21.5 11.9 4.9
11.7 3.9 17.9 25.8 29.5 30.4 30.5 30.2 23.4 17.7 12.2 7.7
10.7 3.9 20.4 21.5 31.3 29.1 29.3 27.6 23.5 17.4 13.4 2
11.1 23.4 19.7 23.7 25.1 29.3 21.9 23.5 17.2 13.4 7.6
11.3 22.1 18.8 23.3 25.1 28.3 29.4 23.5 26.4 13.4 6.9
11.3 22.6 28 28.3 30.4 26.7 1.9

Auric__

unread,
Jun 29, 2022, 12:41:03 PM6/29/22
to
Try this:

Sub allToOne()
Dim first As Range, last As Range
Dim L0, L1
'start with the cell immediately to the right of current cell
Set first = ActiveCell.Offset(0, 1)
'do everything to the right of the current cell
Set last = Cells.SpecialCells(xlCellTypeLastCell)
'assumes the first column has no empty cells, based on posted example
Cells(last.Row + 1, first.Column - 1).Select
For L0 = first.Column To last.Column
For L1 = first.Row To last.Row
'blank check
If Cells(L1, L0).Value <> "" Then
ActiveCell.Value = Cells(L1, L0).Value
ActiveCell.Offset(1, 0).Select
End If
Next L1
'play nice with other running programs
DoEvents
Next L0
'return to first copied cell
Cells(last.Row + 1, first.Column - 1).Select
End Sub

Assumes that your sheet has nothing but data to be copied on it. Select the
top cell of the column to be copied to and run.

--
Everything in excess! To enjoy the flavor of life,
take big bites. Moderation is for monks.
0 new messages