macros across multiple worksheets in workbook

J

jer

Not sure if this is for here so I am posting here and in
the programming group. I have a workbook with multiple
sheets, a master sheet and "supporting" sheets all of
which are formatted similiarly. The supporting sheets are
subsets of the master broken down by type of transactions
based on customer. I have used the following to get the
results I want on the mastersheet (all this is still
relatively new to me), however when I use the macro on the
other sheets I am getting all zeros. Can anyone say why
this is happening or am I doing something wrong.

The ranges to sum are dynamic and not a static size.

Dim nonin As Range, nonout As Range, nbkcell As Range
Set nbkcell = ActiveSheet.Cells(65536, 5).End
(xlUp).Offset(1, 0)
Set nonin = Intersect(Range("e:e"),
ActiveSheet.UsedRange)
Set nonout = nonin.Offset(0, 3)
nonin.Name = "nonin"
nonout.Name = "nonout"

nbkcell.Offset(2, 0).Value = "=SUM(nonin)"
nbkcell.Offset(2, 3).Value = "=SUM(nonout)"
nbkcell.Offset(2, -1).Value = "=COUNT(nonin)"
nbkcell.Offset(4, 0).Value = "=SUM(nonin,nonout)"

TIA for any suggestions help
jer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top