Copy and insert macro

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

I have been trying to create a button that inserts a group
of cells between existing cells on a worksheet. I have
been able insert those cells at the end of the worksheet
but have been unable to figure out how to insert them
between exisiting cells.

To clarify; The following is a simple representation of
what I am trying to accomplish:

Row 1 - Task Name and cost
Row 2 - Task Name and cost
Row 3 - Sub Totals and markups
Row 4 - End of used cells

I need to be able to add multiple tasks between the
last 'Task Name and cost' and 'Sub Totals and markups'. I
would like to accomplish this function through the use of
a command button which would insert the new task between
position 1 and 2 when clicked.

It is possible to have dozens of tasks once the sheet is
completed but I need the ability to add those tasks on an
individual basis.

Could anyone give me some suggestions on how to accomplish
the above? I would greatly appreciate any assistance.

Thanks,

Dennis
 
Dennis
You need to give more info about what you want. What you want to do is
fairly easy to accomplish. Some specifics you need to provide are:
Do you want to insert a blank row?
Do you want to insert more than one blank row in each instance?
How do you want to designate where you want the blank row inserted? For
instance, above the row with the active cell? Two rows down from the row
with the active cell? Etc?
You say to insert a new task. Do you mean you want to copy some data from
somewhere and paste it in a newly inserted blank row?
Post back with more detail. HTH Otto
 
Otto,

First of all thanks for the help. Here are the answers to
your questions:

Do you want to insert a blank row? - Yes, I do, but only
one blank between each instance.

How do you want to designate where you want the blank row
inserted? - I would like the row to be inserted below the
last active cell.

With regards to the insertion of a new task; what I am
trying to do is establish a worksheet that will allow me
to copy a group of cells which contains the basic
information on the new task. This basic information is
then modified to describe the specific task, such as what
is to be accomplished and the charge out rates associated
with each member of the workforce. So, I would like to
copy some data and insert it into the newly inserted blank
rows but that insertion point needs to fall below the
previous task and above the calculations for the mark ups
and totals.

If you need any more information please let me know and I
greatly appreciate your help with this.

Thanks,

Dennis
 
Hi Dennis,

Below the InsertRowsAndFillFormulas macro on
http://www.mvps.org/dmcritchie/excel/insrtrow.htm
is this macro which invokes the above. I may be wrong but it would seem
to me that inserting the blank row is really so you can enter information
into it.

Sub InsertBeforeTotalinColumnA()
Columns("A:A").Find(What:="total", After:=Range("A2"), LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Offset(-1, 0).Activate
Call InsertRowsAndFillFormulas(1) 'see my insrtrow.htm page
End Sub

Otherwise specifically what you asked for would be (dependent on
something in column A), Inserting a blank row.

Sub InsertBlankRowBeforeLast()
Cells(Rows.Count, "A").End(xlUp).EntireRow.Insert
End Sub
 
Back
Top