Thread: Help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kevin Kevin is offline
external usenet poster
 
Posts: 134
Default Help

I have code in an application I am developing which sums
the values in rows of data. The code is as follows:

Do While curRow <= maxRow

Set sumrng = Range(Cells(curRow, 2), Cells(curRow, rowNum))
SumItemWt = Application.WorksheetFunction.Sum(sumrng)
Worksheets(1).Cells(curRow, rowNum+ 1).Value2 = SumItemWt

curRow = curRow + 1

Loop

My users will enter data into the spreadsheet where each
column represents a record. In each column over the width
of my spreadsheet (I am using 22 columns) has a formula
which performs calculations on data entered above in each
column. When the code shown above runs, the formula in
each cell gets pushed down the column. This code runs on
12 rows. The formula in the cell that the command
Worksheets(1).Cells(curRow, rowNum+ 1).Value2 = SumItemWt
runs on is pushed down the column by 12 rows. Why! Should
this not just replace the existing formula whith the
SumItemWt value?

Any help will be greatly appreciated!

Kevin