Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Is it possible with a macro??

I have data in six columns (A-F) an Excel spreadsheet. See the duplicate
number 82131400? I want to leave the first 82131400 line alone, but move the
data from second and third *400 rows onto the same row as the first *400
number but into columns (G-R). Possible with a macro? thanks.

82129735 8/31/2006 -120502 1-SO 8/30/2006 8/31/2006
82131400 8/31/2006 -121401 1-SO 8/31/2006 8/31/2006
82131400 LDR802- L/D 8/31/2006 8/31/2006
82131400 LDR901- L/D 8/31/2006 8/31/2006
82128158 8/31/2006 -313101 3-NO 8/29/2006 8/31/2006

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Is it possible with a macro??

Hi

Look at this:

Sub test()
Dim StartCell As Range
Dim CopyCell As Range
Dim off As Long

Set StartCell = Range("A1") ' assuming no headers
Set CopyCell = StartCell.Offset(1, 1)

Do Until StartCell.Offset(1, 0) = ""
If StartCell.Offset(1, 0).Value = StartCell.Value Then
Range(CopyCell.Address, CopyCell.End(xlToRight).Address).Copy _
Destination:=StartCell.End(xlToRight).Offset(0, 1)
StartCell.Offset(1, 0).EntireRow.Delete
Set CopyCell = StartCell.Offset(1, 1)
Else
Set StartCell = StartCell.Offset(1, 0)
Set CopyCell = CopyCell.Offset(1, 0)
End If
Loop
End Sub

Regards,
Per

"cbart" skrev i meddelelsen
...
I have data in six columns (A-F) an Excel spreadsheet. See the duplicate
number 82131400? I want to leave the first 82131400 line alone, but move
the
data from second and third *400 rows onto the same row as the first *400
number but into columns (G-R). Possible with a macro? thanks.

82129735 8/31/2006 -120502 1-SO 8/30/2006 8/31/2006
82131400 8/31/2006 -121401 1-SO 8/31/2006 8/31/2006
82131400 LDR802- L/D 8/31/2006 8/31/2006
82131400 LDR901- L/D 8/31/2006 8/31/2006
82128158 8/31/2006 -313101 3-NO 8/29/2006 8/31/2006


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Is it possible with a macro??

Thank you so much!!!

"Per Jessen" wrote:

Hi

Look at this:

Sub test()
Dim StartCell As Range
Dim CopyCell As Range
Dim off As Long

Set StartCell = Range("A1") ' assuming no headers
Set CopyCell = StartCell.Offset(1, 1)

Do Until StartCell.Offset(1, 0) = ""
If StartCell.Offset(1, 0).Value = StartCell.Value Then
Range(CopyCell.Address, CopyCell.End(xlToRight).Address).Copy _
Destination:=StartCell.End(xlToRight).Offset(0, 1)
StartCell.Offset(1, 0).EntireRow.Delete
Set CopyCell = StartCell.Offset(1, 1)
Else
Set StartCell = StartCell.Offset(1, 0)
Set CopyCell = CopyCell.Offset(1, 0)
End If
Loop
End Sub

Regards,
Per

"cbart" skrev i meddelelsen
...
I have data in six columns (A-F) an Excel spreadsheet. See the duplicate
number 82131400? I want to leave the first 82131400 line alone, but move
the
data from second and third *400 rows onto the same row as the first *400
number but into columns (G-R). Possible with a macro? thanks.

82129735 8/31/2006 -120502 1-SO 8/30/2006 8/31/2006
82131400 8/31/2006 -121401 1-SO 8/31/2006 8/31/2006
82131400 LDR802- L/D 8/31/2006 8/31/2006
82131400 LDR901- L/D 8/31/2006 8/31/2006
82128158 8/31/2006 -313101 3-NO 8/29/2006 8/31/2006



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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
AutoRun Macro with a delay to give user the choice to cancel the macro wanderlust Excel Programming 2 September 28th 07 04:09 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


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