Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default reformatting a table

I have a spreadsheet with songtitles associated to a CD catlaogue numbe
that is laid out like this:

[image: http://www.firstfoot.com/Library/images/excelsheet.jpg]

To get it into a format to impert it into a database, I need to make i
look like this:

[image: http://www.firstfoot.com/Library/ima...celsheet2.jpg]

Where the song title is horizontally aligned with each catalogu
number.

But I just can't suss the macro to do it.

My head is sore from banging it on the screen. Any ideas

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default reformatting a table

Here is one way

Sub CDCollection()
Dim cLastRow As Long
Dim rng As Range
Dim i As Long

Columns("A:A").Cut
Range("C1").Insert Shift:=xlToRight
cLastRow = Cells(Rows.Count, "A").End(xlUp).row
For i = cLastRow To 2 Step -1
If Cells(i, "A").Value = Cells(i - 1, "A").Value Then
Cells(i, "A").Offset(0, 1).Resize(1, 20).Copy _
Destination:=Cells(i - 1, "C")
If rng Is Nothing Then
Set rng = Cells(i, "A")
Else
Set rng = Union(rng, Cells(i, "A"))
End If
End If
Next i

If Not rng Is Nothing Then
rng.EntireRow.Delete
End If
Range("A1").Select

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"firstfoot " wrote in message
...
I have a spreadsheet with songtitles associated to a CD catlaogue number
that is laid out like this:

[image: http://www.firstfoot.com/Library/images/excelsheet.jpg]

To get it into a format to impert it into a database, I need to make it
look like this:

[image: http://www.firstfoot.com/Library/ima...celsheet2.jpg]

Where the song title is horizontally aligned with each catalogue
number.

But I just can't suss the macro to do it.

My head is sore from banging it on the screen. Any ideas?


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default reformatting a table

Bob

Many thanks for that.

It worked a treat and has saved me from inflicting more pain on m
already severely bruised head:

--
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
Reformatting ILoveMyCorgi Excel Discussion (Misc queries) 5 January 12th 10 06:42 AM
Help With Reformatting Robert Excel Discussion (Misc queries) 0 July 23rd 09 02:56 PM
Stopping a pivot table from reformatting column sizes and widths Schwimms Excel Discussion (Misc queries) 1 November 12th 07 11:19 PM
reformatting dates [email protected] Excel Discussion (Misc queries) 6 July 12th 07 09:09 PM
REformatting PivotChart Jon Peltier[_3_] Excel Programming 1 August 8th 03 05:45 AM


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