Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Excel-Auto Sort and Paste to new Column

How can I instruct Excel to create a new heading for all like data that is
currently in the same field?

For example, my data looks like this now:


1) A B C D E (Headings Row)
2) a b c x z
3) a b c x y
4) a b c z x
5) a b c y z
6) a b c d e

I need it the data to look like this without having to sort, cut and paste.
There is
too much data to sort, cut and paste. Note: In the sample below, x, y, and
z data now have their own fields (columns)

1) A B C D E X Y Z (Headings Row)
2) a b c x z
3) a b c x y
4) a b c x z
5) a b c y z
6) a b c d e
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Excel-Auto Sort and Paste to new Column

This macro copies the data from sheet1 to sheet2. I don't like over writing
existing data. When yo are done you can always delete the original data.

Sub createcolumns()

RowCount = 2
Sh2LastCol = 2
With Sheets("Sheet1")
Do While .Range("A" & RowCount) < ""
LastCol = .Cells(RowCount, Columns.Count). _
End(xlToLeft).Column
For Sh1ColCount = 1 To LastCol
Data = .Cells(RowCount, Sh1ColCount)
With Sheets("Sheet2")

Set c = .Rows(1).Find(what:=Data, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
.Cells(1, Sh2LastCol) = Data
.Cells(RowCount, Sh2LastCol) = Data
Sh2LastCol = Sh2LastCol + 1
Else
.Cells(RowCount, c.Column) = Data
End If
End With
Next Sh1ColCount
RowCount = RowCount + 1
Loop
End With

End Sub
"ManhattanRebel" wrote:

How can I instruct Excel to create a new heading for all like data that is
currently in the same field?

For example, my data looks like this now:


1) A B C D E (Headings Row)
2) a b c x z
3) a b c x y
4) a b c z x
5) a b c y z
6) a b c d e

I need it the data to look like this without having to sort, cut and paste.
There is
too much data to sort, cut and paste. Note: In the sample below, x, y, and
z data now have their own fields (columns)

1) A B C D E X Y Z (Headings Row)
2) a b c x z
3) a b c x y
4) a b c x z
5) a b c y z
6) a b c d e

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
Auto-sort worksheet by date in column A avshook Excel Discussion (Misc queries) 4 August 29th 18 12:40 PM
Auto Sort by column B Moira Excel Worksheet Functions 1 October 28th 08 08:13 PM
Auto-Sort Won't Sort All Column Cells TikiTembo Excel Discussion (Misc queries) 1 March 25th 08 07:00 PM
How can I set up Excel to auto-sort each column independently? davisjw Excel Worksheet Functions 2 March 17th 08 11:21 AM
Auto data sort by clicking on column Jack C Excel Discussion (Misc queries) 2 August 29th 07 01:02 PM


All times are GMT +1. The time now is 07:30 AM.

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

About Us

"It's about Microsoft Excel"