Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Need to combine data programatically.

Here is my spreadsheet

369 Medical Authorization/Utilization
370 Apportionment
370 Settlement
371 Apportionment
371 Settlement
372 Apportionment


For my final results I would like to see

369 Medical Authorization/Utilization
370 Apportionment, Settlement
371 Apportionment, Settlement
372 Apportionment

So I a column has a duplicate value, I would like to combine those into one
row and delete the row after combining. There could be more than two
matches.

Any ideas on how to do this?




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Need to combine data programatically.

"HearSay" wrote in message
...
: Here is my spreadsheet
:
: 369 Medical Authorization/Utilization
: 370 Apportionment
: 370 Settlement
: 371 Apportionment
: 371 Settlement
: 372 Apportionment
:
:
: For my final results I would like to see
:
: 369 Medical Authorization/Utilization
: 370 Apportionment, Settlement
: 371 Apportionment, Settlement
: 372 Apportionment
:
: So I a column has a duplicate value, I would like to combine those into
one
: row and delete the row after combining. There could be more than two
: matches.
:
: Any ideas on how to do this?
:
Assuming your first column is in the order you want something like this is a
start

Sub CombineCells()
Dim TotalRows As Integer, iCount As Integer

With ActiveSheet
TotalRows = .UsedRange.Rows.Count
For iCount = TotalRows To 2 Step -1
If .Cells(iCount, 1).Value = .Cells(iCount - 1, 1).Value Then
.Cells(iCount - 1, 2).Value = .Cells(iCount - 1, 2).Value & ", " &
..Cells(iCount, 2).Value
.Rows(iCount).Delete
End If
Next iCount
End With
End Sub

The main thing to note is if you are deleting rows, then you have to work
from the bottom up. This is why the routine finds the usedrange, gets the
number of rows, then counts up (step -1). You may want to modify this
routine if you have a predefined range you want to check or if your starting
row is not 1.

Paul D


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
Easiest way to import sharpoint list data into excel programatically Jay A. Ritchie Excel Programming 1 February 12th 06 10:17 PM
Easiest way to import sharpoint list data into excel programatically Jay A. Ritchie[_2_] Excel Programming 0 February 1st 06 05:35 PM
Retrieve Data from SQL database Programatically using Excel VBA ebferro Excel Programming 0 December 2nd 05 04:26 PM
programatically change the data source of Pivots Help me Excel Programming 1 November 10th 05 05:31 AM
Problems entering Data validation Programatically J Streger Excel Programming 3 April 1st 05 05:30 PM


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