Help creating a macro please

S

suestew

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!
 
J

JLGWhiz

That looks like the text has wrapped because of the column width. Have you
tried increasing the width of the column to accomplish your objective? You
can place the mouse pointer between the column header on the separation line
and when the pointer changes shape, hold the left mouse button down and drag
the line to the right to widen a column left of the line. When you get the
width you need, save the file.
 
J

Joel

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
 
S

suestew

That worked exept for one thing I forgot to mention:

Some of the numbers have an asterik (*) in front of them. So the macro
needs to be altered slightly so that anything that isn't a number or begins
with an asterick. Is that possible?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top