View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Help creating a macro please

I had to use trim to remove all the blank characters to check for a number.
I then added 1 space between the two lines that I combined.


Sub CombineRows()

RowCount = 2
Do While Range("A" & RowCount) < ""
Data = Trim(Range("A" & RowCount))
If Not IsNumeric(Left(Data, 1)) Then
Range("A" & (RowCount - 1)) = _
Range("A" & (RowCount - 1)) & " " & Data
Rows(RowCount).Delete
Else
RowCount = RowCount + 1
End If
Loop
End Sub


"suestew" wrote:

I need every row which doesn't begin with a number to be incorporated into
the row directly before it. Here is an example of how the spreadsheet looks:

1. Transportation Request...................1,
2. Information..............................2, thru 4,
3. Summons and Return of Service............5, thru 7,
4. Minute Entry - July 27, 1995 -...........8, thru 13,
5. Transportation Request..................14,
6. Defense Attorney List and Notice........15, thru 17,
7. Notice..................................18,
8. Appearance of Counsel...................19,
9. Formal Request For Discovery Pursuant To
Procedure...............................20, 21,

I need the row that comes just below entry 9. (Procedure....)to go right
after the text in row 9. (Formal Request For Discovery Pursuant To)

There are hundreds of instances in my spreadsheet where this is the case.

Thanks!