Linking worksheets

  • Thread starter Thread starter Robert R Johnson
  • Start date Start date
R

Robert R Johnson

I am working on an estimating program in which I calculate
the price of an object with a spread sheet. I currently
post the result of that calculation to a summary spread
sheet and then total all the calculations to come up with
the final price of the object. My problem is that not all
the itens that are linked to the summary spread sheet
should be posted to the summary spread sheet. Only those
results that have a value should be posted. I do not want
to post results that have a zero as ther result posted.
Furthermore I would like to not have lines that are empty
in the summary spread sheet. Is there a way to accomplish
this task using excell or VBA formulas or macros? A second
problem is that I would like to link text about the
results in the same fashion. Way over my head! Bob
 
Hard to tell without details but something like this should work
sub sumemup()
if sheets("sheet3").range("a2")>0 then
sheets("summary").range("a2")=sheets("sheet3").range("a2")
if sheets("sheet3").range("a3")>0 then
sheets("summary").range("a3")=sheets("sheet3").range("a3")
end sub
 
Robert,

The easiest link is a formula:
=Sheet1!A1
(change 'Sheet1' and 'A1' to suit)
This links numbers and text.

You can change this to:
=If(Sheet1!A1=0,"",Sheet1!A1)
to leave cells blank if there is nothing.

You can also combine text from different cells:
=Sheet1!A1&Sheet1!B1
or to add a space
=Sheet1!A1&" "&Sheet1!B1

Hope this is what you are looking for.

You can also build this into code.
Sheets("Sheet2").Range("A1") = Sheets("Sheet1").Range("A1")

And you can use an If statement in code:
If Len(Sheets("Sheet1").Range("A1")) > 0 then
Sheets("Sheet2").Range("A1") = Sheets("Sheet1").Range("A1")
End If

AND you can build a loop to do this in a range of cells...

Post back if you need further help...
 
Back
Top