Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Help with Code

FIRST.... Let me say thanks for all the help I have received. I am new to
this position and new to VBA and nobody at the company knows it so You all
have been a life saver for me!!!

Here is the question:

Can I write code so than in the worksheet If cell D1 has the value of "Y",
and the user tries to enter data in E1, the cell (E1) would be disabled from
any entries going in?

Thanks again!!!

TimN
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Help with Code

In a protected sheet you can only change the unlocked cells.
So try to protect this sheet first and then lock or unlock the cell "E1"
depends on the value in cell "D1".

Code would be

if range("D1")="Y" then
range("E1").locked=true
else
range("E1").locked=false
endif

"TimN" wrote:

FIRST.... Let me say thanks for all the help I have received. I am new to
this position and new to VBA and nobody at the company knows it so You all
have been a life saver for me!!!

Here is the question:

Can I write code so than in the worksheet If cell D1 has the value of "Y",
and the user tries to enter data in E1, the cell (E1) would be disabled from
any entries going in?

Thanks again!!!

TimN

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Help with Code

Great idea.

Where do I put this code? Is it in the This Workbook module?
All the rest of my code I have driving message boxes, user forms ets. I'm
not sure how to work with this situation where the code just effects a cell
in the workbook.

"salut" wrote:

In a protected sheet you can only change the unlocked cells.
So try to protect this sheet first and then lock or unlock the cell "E1"
depends on the value in cell "D1".

Code would be

if range("D1")="Y" then
range("E1").locked=true
else
range("E1").locked=false
endif

"TimN" wrote:

FIRST.... Let me say thanks for all the help I have received. I am new to
this position and new to VBA and nobody at the company knows it so You all
have been a life saver for me!!!

Here is the question:

Can I write code so than in the worksheet If cell D1 has the value of "Y",
and the user tries to enter data in E1, the cell (E1) would be disabled from
any entries going in?

Thanks again!!!

TimN

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Help with Code

My only other thought is that since the default setting on cells is "locked",
you might have to unlock all of the cells and then re-lock E1 if you want to
be able to change other cells on the spreadsheet.

Dan

"salut" wrote:

In a protected sheet you can only change the unlocked cells.
So try to protect this sheet first and then lock or unlock the cell "E1"
depends on the value in cell "D1".

Code would be

if range("D1")="Y" then
range("E1").locked=true
else
range("E1").locked=false
endif

"TimN" wrote:

FIRST.... Let me say thanks for all the help I have received. I am new to
this position and new to VBA and nobody at the company knows it so You all
have been a life saver for me!!!

Here is the question:

Can I write code so than in the worksheet If cell D1 has the value of "Y",
and the user tries to enter data in E1, the cell (E1) would be disabled from
any entries going in?

Thanks again!!!

TimN

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Help with Code

If it is specific to one worksheet, you can put the code in that sheet module
in the editor. You probably want to put it under a worksheet_change event

Private Sub Worksheet_Change(ByVal Target As Range)

Cells.Locked = False
If Range("D1").Value = "Y" Then
Range("E1").Locked = True
End If
End Sub




"TimN" wrote:

Great idea.

Where do I put this code? Is it in the This Workbook module?
All the rest of my code I have driving message boxes, user forms ets. I'm
not sure how to work with this situation where the code just effects a cell
in the workbook.

"salut" wrote:

In a protected sheet you can only change the unlocked cells.
So try to protect this sheet first and then lock or unlock the cell "E1"
depends on the value in cell "D1".

Code would be

if range("D1")="Y" then
range("E1").locked=true
else
range("E1").locked=false
endif

"TimN" wrote:

FIRST.... Let me say thanks for all the help I have received. I am new to
this position and new to VBA and nobody at the company knows it so You all
have been a life saver for me!!!

Here is the question:

Can I write code so than in the worksheet If cell D1 has the value of "Y",
and the user tries to enter data in E1, the cell (E1) would be disabled from
any entries going in?

Thanks again!!!

TimN



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Help with Code

A thought comes to mind. You say you want entry into that cell disabled.
Do you want to just disable it and not tell the user anything about why he
can't enter anything into that cell? Or do you want him to not be able to
enter anything into that cell AND tell him so and why when he tries to do
it? HTH Otto
"TimN" wrote in message
...
FIRST.... Let me say thanks for all the help I have received. I am new to
this position and new to VBA and nobody at the company knows it so You all
have been a life saver for me!!!

Here is the question:

Can I write code so than in the worksheet If cell D1 has the value of "Y",
and the user tries to enter data in E1, the cell (E1) would be disabled
from
any entries going in?

Thanks again!!!

TimN



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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
run code on opening workbook and apply code to certain sheets Jane Excel Programming 7 August 8th 05 09:15 AM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM
option buttons run Click code when value is changed via VBA code neonangel Excel Programming 5 July 27th 04 08:32 AM


All times are GMT +1. The time now is 12:38 PM.

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"