Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Help creating a macro please

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!



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Help creating a macro please

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.

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Help creating a macro please

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?

"Joel" wrote:

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!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Help creating a macro please

Disregard my last comment. I figured it all out. Thanks!

"Joel" wrote:

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!



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
Creating a macro JC Excel Programming 5 January 10th 08 05:04 PM
Could use some help creating a macro.... texasx96 Excel Programming 2 April 24th 06 08:32 PM
Creating a macro which presses a button containing a recorded macro petros89[_3_] Excel Programming 3 October 5th 05 02:49 PM
Creating a macro Gene Goldenfeld New Users to Excel 10 May 5th 05 04:28 PM


All times are GMT +1. The time now is 06:51 PM.

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"