Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Locking cells with formulas

I've got a s/sheet where here are some cells with the RAND function in them.
If a user enters a number in cell j2 the sheet runs and all is OK. However
the results change if a user enters any thing in any other cell and presses
enter. Is there anyway to prevent this so that the cells change only if J2 is
changed? Cell locking does not do this unfortunately.
Cheers

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 396
Default Locking cells with formulas

You can protect all cells except J2.


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"ArtySin" wrote:

I've got a s/sheet where here are some cells with the RAND function in them.
If a user enters a number in cell j2 the sheet runs and all is OK. However
the results change if a user enters any thing in any other cell and presses
enter. Is there anyway to prevent this so that the cells change only if J2 is
changed? Cell locking does not do this unfortunately.
Cheers

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Locking cells with formulas

No that doesn't work. If you unlock the cells that you want to change by
using the Ctrl+1 font dialog box and then protect the w/sheet, when you enter
data in an unlocked cell it still changes the data in the locked cells.

"Wigi" wrote:

You can protect all cells except J2.


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"ArtySin" wrote:

I've got a s/sheet where here are some cells with the RAND function in them.
If a user enters a number in cell j2 the sheet runs and all is OK. However
the results change if a user enters any thing in any other cell and presses
enter. Is there anyway to prevent this so that the cells change only if J2 is
changed? Cell locking does not do this unfortunately.
Cheers

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Locking cells with formulas

This seems to work.....but nothing will caclulate if J2 is not changed so may be
a side effect you don't want.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.Calculation = xlManual
If Target.Address = "$J$2" Then
Application.Calculate
End If
End Sub

Right-click on the sheet tab and "View Code". Copy/paste the code into that
sheet module.

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP

On Sat, 19 Jul 2008 15:57:01 -0700, ArtySin
wrote:

No that doesn't work. If you unlock the cells that you want to change by
using the Ctrl+1 font dialog box and then protect the w/sheet, when you enter
data in an unlocked cell it still changes the data in the locked cells.

"Wigi" wrote:

You can protect all cells except J2.


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"ArtySin" wrote:

I've got a s/sheet where here are some cells with the RAND function in them.
If a user enters a number in cell j2 the sheet runs and all is OK. However
the results change if a user enters any thing in any other cell and presses
enter. Is there anyway to prevent this so that the cells change only if J2 is
changed? Cell locking does not do this unfortunately.
Cheers


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Locking cells with formulas

Oooops!

Slight flaw in previous post.

This might be better

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.Calculation = xlManual
If Target.Address = "$J$2" Then
Application.Calculate
End If
End Sub


Gord

On Sat, 19 Jul 2008 16:27:48 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

This seems to work.....but nothing will caclulate if J2 is not changed so may be
a side effect you don't want.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.Calculation = xlManual
If Target.Address = "$J$2" Then
Application.Calculate
End If
End Sub

Right-click on the sheet tab and "View Code". Copy/paste the code into that
sheet module.

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP

On Sat, 19 Jul 2008 15:57:01 -0700, ArtySin
wrote:

No that doesn't work. If you unlock the cells that you want to change by
using the Ctrl+1 font dialog box and then protect the w/sheet, when you enter
data in an unlocked cell it still changes the data in the locked cells.

"Wigi" wrote:

You can protect all cells except J2.


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"ArtySin" wrote:

I've got a s/sheet where here are some cells with the RAND function in them.
If a user enters a number in cell j2 the sheet runs and all is OK. However
the results change if a user enters any thing in any other cell and presses
enter. Is there anyway to prevent this so that the cells change only if J2 is
changed? Cell locking does not do this unfortunately.
Cheers


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
locking formulas John Bundy Excel Discussion (Misc queries) 0 March 8th 07 07:14 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Locking Formulas to Cells spartikus New Users to Excel 1 March 22nd 06 05:02 PM
locking formulas?? Rob Excel Discussion (Misc queries) 1 July 27th 05 09:27 AM
locking formulas speary Excel Discussion (Misc queries) 6 July 21st 05 06:19 PM


All times are GMT +1. The time now is 11:13 AM.

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

About Us

"It's about Microsoft Excel"