View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
rwr rwr is offline
external usenet poster
 
Posts: 1
Default Need Help with VBA code for an Excel Model Macro

wrote:
The last row is relative to a group of costs. The reference is to
insert a line at the bottom of each group of costs. For example:
there is Land Acquisition Costs, Land Development Costs, Direct Costs,
etc. Under each of these is several lines of costs related to each
group of costs. The macro needs to select the bottom row of a group
(each group will have its own macro for inserting a line item) say
Land Acquisition costs. Here the macro needs to insert a a new line
copying the formating and formulas from the line above it then proceed
to a financing page to insert that line into its subsequent location
amongst 5 different loans. It would be easier to post the model to
visualize this, but I am unaware if this is possible. Unfortuantely,
I don't have subsequent knowledge of VBA, only of what I want the
macro to do. Is there a way to have someone write the code for me if
they were to see the model? If not, any help with understanding how
to write the VBA code to reference the last row of a group of items,
then subsequently copy that new line item throughout the entire model.



Not sure I can completely answer your question, but the problem is YOU
told excel by using the macro recorder where the last line is. Excel
will always insert the new line where you told it.

What you need is VBA code to loop thru your rows looking at the group
to, on-the-fly, find the last row of each group and then use that row
number to do the insert down.

Others better at VBA in Excel should be able to give you an example of
how to write this loop. I am not as strong in Word or Excel VBA as I am
in Access.

Hope this helps.

Ron