Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating a macro | Excel Programming | |||
Could use some help creating a macro.... | Excel Programming | |||
Creating a macro which presses a button containing a recorded macro | Excel Programming | |||
Creating a macro | New Users to Excel |