Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jamie
 
Posts: n/a
Default Locked cells not updating

I dont know if you need all this background to answer my question, but it
couldnt hurt.

I am working in Excel 2002. Currently I have a table (A1:U14), 13 rows of
data, row 14 is the Total row. There are 2 columns (columns F and J) that
have formulas which calculate 3 columns preceding them (column Fs formula is
=SUM(C5:E5), column Js formula is =SUM(G5:I5). These 2 columns with the
formulas are locked cells. The Total row has formulas which calculate the
figures in each column, the formula is =SUM(C5:C13), the cells in this row
are also locked.

I have unlocked all the cells that I want the user to have access to and
have protected the sheet.

Rows can be inserted into this table, by the user with this macro which is
assigned to a command button:

Sub AddRow()

Dim Msg, Style, Title, Response
Dim rngAdd As Range
Set rngAdd = ActiveCell

Msg = "Do you want to insert a row?" 'Define message.
Style = vbYesNo + vbDefaultButton2 'Define buttons.
Title = "Insert a Row" 'Define MsgBox title.

Response = MsgBox(Msg, Style, Title)

If Response = vbYes Then 'User chose Yes.

ActiveSheet.Unprotect

rngAdd.Offset(1, 0).EntireRow.Insert
rngAdd.EntireRow.Copy

Set rngAdd = rngAdd.Offset(1, 0)

rngAdd.PasteSpecial xlPasteFormats
rngAdd.PasteSpecial xlPasteFormulas
rngAdd.EntireRow.SpecialCells(xlCellTypeConstants) .ClearContents

ActiveSheet.Protect

End If

End Sub

When figures are entered into the cells of this new row, the formulas in the
Total row do not recognize that a row has been added. When I unprotect the
sheet, the formula in the Total row is =SUM(C5:C13). The formula should
change to =SUM(C5:C14) with the addition of the new row.

Im assuming it is not updating due to the cells being locked. How can I
have the Total row recognize a new row has been added, yet keep the user from
enter information into the cells of the Total row by mistake?

--
Jamie
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
To safety merge cells without data destroyed, and smart unmerge! Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:17 AM
Heps to design Locked/Unlocked cells in protected worksheet Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:09 AM
Convert data of cells to any type: Number, Date&Time, Text Kevin Excel Discussion (Misc queries) 0 December 30th 04 06:55 AM
Locked cells Pam Coleman Excel Worksheet Functions 1 November 18th 04 02:45 PM
Excel 2003 isn't updating my cells [email protected] Excel Worksheet Functions 7 November 5th 04 04:05 PM


All times are GMT +1. The time now is 04:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"