View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default Macro to build code

Be happy to talk to you Melinda, but I'm certainly not an expert at building
code, I'm more like a self-taught beginner at this. If you'd like to contact
me you can do so at this email less the spams....

And I'm not good enough to be charging for this service, but there are many
on here that do that for a living....and they are "GOOD", and they're more
than helpful sharing their knowledge.

Have a good day,

Don

"Dave" wrote:

Don:

Thank you so much for your help. I'm wondering if it would be possible to
talk to you offlist. I'm wondering if it would be possible to hire you to
help me build a more complex macro for this spreadsheet.

Thanks,
Melinda


"Don" wrote:

Dave,

The code I posted assumes your data is in Col A...adjust as necessary. If
needed I can add an input box to the macro that will let you choose which
column the macro should read. Let me know.

Don



"Don" wrote:


Dave,

Not sure how your data is laid out but if all your entries are in one
column, the macro below will seperate each existing row and copy and paste
the data into six cells below same. I've tested this to about 7000 rows with
no problem but try it on a copy of your WS just to be safe.

Option Explicit

Sub AddSixRows()

Dim i, t As Long
Dim LastRow As Long
On Error Resume Next

' find the last row used
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

' select the last cell used
Range("A" & LastRow).Select

' insert 6 rows between each cell from last cell up
For t = LastRow - 1 To 1 Step -1
For i = 1 To 6
Selection.EntireRow.Insert
Next
Range("A" & t).Select
Next

' find the current last row used
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

' copy data to the six empty rows
For i = 1 To LastRow Step 7
Range("A" & i).Select
Selection.Copy
For t = 1 To 6
Selection.Offset(1, 0).Select
ActiveSheet.Paste
Next
Next

' cut copy mode
Application.CutCopyMode = False

End Sub

HTH,

Don
"Dave" wrote:

I have a spreadsheet of items and their sizes. Each item has 7 sizes. I need
to add 6 rows under each item and copy the data from the from the first row.
There are 150 items in the spreadsheet and I basically need to create a macro
to copy each item 6 times right underneath the original item.

I'm not very familiar with macros. When I started trying this, I just kept
getting the macro to create the same row over and over.

Any help would be greatly appreciated.