View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Luke M Luke M is offline
external usenet poster
 
Posts: 2,722
Default MACRO THAT BUILDS ON ANOTHER MACRO'S DATA

Here's a macro that calls out another macro. Change the Application.Run line
as appropriate to match the name of your workbook and macro the Ron gave you.
You may also need to change the name of the sheet to be selected.

Sub AddFormulas()

'Change this line as appropriate
Application.Run "YourWorkbook!NameOfOtherMacro"

'Change as appropriate
Sheets("Name of Sheet").select
For Each Cell In Range("C:C")

x = Cell.Row

'Checks to make sure past header rows
'and that cell in column C is not empty
If x < 2 Or IsEmpty(Cell) Then
'do nothing
Else

'Create your formulas
Cells(x, "I").Formula = "=D" & x & "+E" & x & "-F" & x
Cells(x, "J").Formula = "=D" & x & "+E" & x & "-H" & x
Cells(x, "K").Formula = "=G" & x
Cells(x, "L").Formula = "=K" & x & "-K" & x
End If

Next
End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Tree" wrote:

I have posted this 2ce but I think I did a very bad job of explaining what I
was looking for.. Hopefully I have done a better job now as I really need the
assistance!

Ron Bruin helped with a macro that combines data from several tabs into one
sheet and that macro works great..

I want to create a macro that runs Ron's macro and then with that resulting
data, does the following:

(Row 1 contains headers from Ron's macro and I can't find how to have the
Resulting Data Macro "Start"? on Row 2-also, Ron's macro seems to create 3
total header rows and I have to delete 2 of them in the "Resulting Data "
macro);

Columns A-H contain the data from the combo macro; Columns I:L would contain
formulas (each column has a unique formula and uses the data from Columns
D-H... BUT they only run IF Column C has text..

The formulas are as follows:

Column I has Column D + Column E - Column F..
Column J has Column D + Column E - Column H
Column K = Column G.
Column L has Column J - Column K.

And these formulas need to insert themselves in the respective rows in
Columns I-L as long as there is text in Column C from the already run combo
macro..

I appreciate your assistance!!!