Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Bernie Deitrick
 
Posts: n/a
Default convert to specific format

True,

Select a cell in your two columns and run the macro below, then copy and transpose the resulting
table.

HTH,
Bernie
MS Excel MVP

Sub DBtoCrossTab()
Dim myCell As Range
Dim myTable As Range
Dim mySht As Worksheet
Dim myRow As Long

Set myTable = ActiveCell.CurrentRegion

On Error Resume Next
Application.DisplayAlerts = False
Worksheets("Cross Tab").Delete
Application.DisplayAlerts = True

Set mySht = Worksheets.Add
mySht.Name = "Cross Tab"

myTable.Rows(1).EntireRow.Copy mySht.Rows(1)

Set myTable = myTable.Offset(1, 0).Resize _
(myTable.Rows.Count - 1, myTable.Columns.Count)

For Each myCell In myTable.Columns(1).Cells
If IsError(Application.Match(myCell.Value, _
mySht.Range("A:A"), False)) Then
myCell.EntireRow.Copy _
mySht.Range("A65536").End(xlUp)(2).EntireRow
Else
myRow = Application.Match(myCell.Value, _
mySht.Range("A:A"), False)
myCell.Offset(0, 1).Resize(1, myTable.Columns.Count - 1).Copy _
mySht.Cells(myRow, 256).End(xlToLeft)(1, 2)
End If
Next myCell

End Sub



"true_atlantis" wrote in message
news:true_atlantis.25ggtn_1143676501.7328@excelfor um-nospam.com...

lets say i have two columns like this...

aa 54
aa 45
bb 12
bb 18
bb 12
cc 13

how can i convert that to a chart like


Code:
--------------------
aa bb cc
54 12 13
45 18
12
--------------------


thanks


--
true_atlantis
------------------------------------------------------------------------
true_atlantis's Profile: http://www.excelforum.com/member.php...o&userid=32957
View this thread: http://www.excelforum.com/showthread...hreadid=527879



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
convert date format noel Excel Discussion (Misc queries) 1 March 26th 06 11:57 PM
Convert Date Format Mike Excel Discussion (Misc queries) 2 November 6th 05 12:27 AM
Convert [h]:mm sum total format to number format Guy Excel Worksheet Functions 1 August 5th 05 05:56 AM
convert number to text and format it. Goda Excel Worksheet Functions 2 February 7th 05 08:07 PM
convert number to text and format it. Goda Excel Worksheet Functions 2 February 7th 05 04:37 PM


All times are GMT +1. The time now is 11:49 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"