LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Break one line item into many...

Someone at this DG gave me this macro back in January (or somewhere around
that time). Hope it works for you...


Sub InsertAnyRows()

Dim insertNumber As Range
Dim insertStart As Range
Dim redRng As Range
Dim i As Integer

Set insertNumber = Application.InputBox _
(Prompt:="Select a point to begin inserting rows. For instance, choose first
non blank cell in Column A", Title:="Add a row", Type:=8)
insertNumber.Select
If insertNumber <= 0 Then
MsgBox ("Invalid Number Entered")
Exit Sub
End If
Dim MyRow As Long

lastcell = Cells(Rows.Count, "A").End(xlUp).Row
MyRow = 1
Do Until MyRow = lastcell
For i = 1 To Cells(MyRow, 1)

If Cells(MyRow, 1) < "" Then
Cells(MyRow + 1, 1).Select
Selection.EntireRow.Insert shift:=xlDown
End If

Next
lastcell = Cells(Rows.Count, "A").End(xlUp).Row
MyRow = MyRow + 1
Loop

End Sub


All you have to do is split the data so that the number shows in Column A
and you can do this by the following method: Data Text to Columns.

Hope it works for you.

Ryan--




"Tom" wrote:

Is there a way or a script I can run to break out one line item into many?
For example

A B (columns)
2 A5285
3 A2358

I would like Excel to recognize that I want 2 lines created from colunm A
and fill A5285 into column B next to it. And subsequently I would like it to
recognize 3 and create three lines from it etc..etc.. So it would look as
below

A B
2 A5285
2 A5285
3 A2358
3 A2358
3 A2358

Thanks in advance!!

Tom



 
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
Automating a line item for several worksheets? tpmax Excel Worksheet Functions 1 June 26th 07 03:56 AM
Break cell into multiple lines by line break Chia Excel Discussion (Misc queries) 1 August 20th 06 06:37 AM
Line Break Ramthebuffs Excel Discussion (Misc queries) 4 August 22nd 05 08:52 PM
Trend Line - break bob Excel Worksheet Functions 1 June 29th 05 09:24 PM
line break in a cell luvgreen Excel Worksheet Functions 2 June 14th 05 06:48 PM


All times are GMT +1. The time now is 12:48 AM.

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"