ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Lock Cell After Enter Command (https://www.excelbanter.com/excel-discussion-misc-queries/222566-lock-cell-after-enter-command.html)

Doug

Lock Cell After Enter Command
 
Is there a way to lock a cell in a shared workbook after the user has made an
entry? I did view Gordon Dibben's response to Casey on 9/23/07. It was
similar to what I am trying to do, but I did not understand where to place
the code in VBA.

DOUG

JLatham

Lock Cell After Enter Command
 
If the routine that Gord provided started with
Sub Worksheet_...
or
Private Sub Worksheet_...

Then it goes into the worksheet area which is easily accessible: right
click on the worksheet's name tab and click the [View Code] option in the
list. Copy and paste the code into the module that appears.

"DOUG" wrote:

Is there a way to lock a cell in a shared workbook after the user has made an
entry? I did view Gordon Dibben's response to Casey on 9/23/07. It was
similar to what I am trying to do, but I did not understand where to place
the code in VBA.

DOUG


Doug

Lock Cell After Enter Command
 
JLatham: Does it matter where I paste the routine on the VBA page?

DOUG

"JLatham" wrote:

If the routine that Gord provided started with
Sub Worksheet_...
or
Private Sub Worksheet_...

Then it goes into the worksheet area which is easily accessible: right
click on the worksheet's name tab and click the [View Code] option in the
list. Copy and paste the code into the module that appears.

"DOUG" wrote:

Is there a way to lock a cell in a shared workbook after the user has made an
entry? I did view Gordon Dibben's response to Casey on 9/23/07. It was
similar to what I am trying to do, but I did not understand where to place
the code in VBA.

DOUG


JLatham

Lock Cell After Enter Command
 
No, not really - if the module that appears when you choose [View Code] from
the sheet's name tab (after right-clicking on it) already has code in it, you
can paste it near the top, or down at the end of existing code.

BUT #1: if there is an "Option Explicit" statement at the beginning of the
module, then paste it in below that statement, and

BUT #2: if there is already a Worksheet_xxx event with the same name you are
wanting to enter, you can't do it. There can only be one event handling
process for a given event [as Worksheet_Change(),
Worksheet_BeforeDoubleClick(), etc] in each worksheet code module. If the
event you need to work with is already "in use" then you have to figure a way
to merge the code you need into what is already there.

"DOUG" wrote:

JLatham: Does it matter where I paste the routine on the VBA page?

DOUG

"JLatham" wrote:

If the routine that Gord provided started with
Sub Worksheet_...
or
Private Sub Worksheet_...

Then it goes into the worksheet area which is easily accessible: right
click on the worksheet's name tab and click the [View Code] option in the
list. Copy and paste the code into the module that appears.

"DOUG" wrote:

Is there a way to lock a cell in a shared workbook after the user has made an
entry? I did view Gordon Dibben's response to Casey on 9/23/07. It was
similar to what I am trying to do, but I did not understand where to place
the code in VBA.

DOUG


Doug

Lock Cell After Enter Command
 
JLatham: Thank you!

DOUG

"JLatham" wrote:

No, not really - if the module that appears when you choose [View Code] from
the sheet's name tab (after right-clicking on it) already has code in it, you
can paste it near the top, or down at the end of existing code.

BUT #1: if there is an "Option Explicit" statement at the beginning of the
module, then paste it in below that statement, and

BUT #2: if there is already a Worksheet_xxx event with the same name you are
wanting to enter, you can't do it. There can only be one event handling
process for a given event [as Worksheet_Change(),
Worksheet_BeforeDoubleClick(), etc] in each worksheet code module. If the
event you need to work with is already "in use" then you have to figure a way
to merge the code you need into what is already there.

"DOUG" wrote:

JLatham: Does it matter where I paste the routine on the VBA page?

DOUG

"JLatham" wrote:

If the routine that Gord provided started with
Sub Worksheet_...
or
Private Sub Worksheet_...

Then it goes into the worksheet area which is easily accessible: right
click on the worksheet's name tab and click the [View Code] option in the
list. Copy and paste the code into the module that appears.

"DOUG" wrote:

Is there a way to lock a cell in a shared workbook after the user has made an
entry? I did view Gordon Dibben's response to Casey on 9/23/07. It was
similar to what I am trying to do, but I did not understand where to place
the code in VBA.

DOUG


JLatham

Lock Cell After Enter Command
 
You're certainly welcome, glad I could help.

"DOUG" wrote:

JLatham: Thank you!

DOUG

"JLatham" wrote:

No, not really - if the module that appears when you choose [View Code] from
the sheet's name tab (after right-clicking on it) already has code in it, you
can paste it near the top, or down at the end of existing code.

BUT #1: if there is an "Option Explicit" statement at the beginning of the
module, then paste it in below that statement, and

BUT #2: if there is already a Worksheet_xxx event with the same name you are
wanting to enter, you can't do it. There can only be one event handling
process for a given event [as Worksheet_Change(),
Worksheet_BeforeDoubleClick(), etc] in each worksheet code module. If the
event you need to work with is already "in use" then you have to figure a way
to merge the code you need into what is already there.

"DOUG" wrote:

JLatham: Does it matter where I paste the routine on the VBA page?

DOUG

"JLatham" wrote:

If the routine that Gord provided started with
Sub Worksheet_...
or
Private Sub Worksheet_...

Then it goes into the worksheet area which is easily accessible: right
click on the worksheet's name tab and click the [View Code] option in the
list. Copy and paste the code into the module that appears.

"DOUG" wrote:

Is there a way to lock a cell in a shared workbook after the user has made an
entry? I did view Gordon Dibben's response to Casey on 9/23/07. It was
similar to what I am trying to do, but I did not understand where to place
the code in VBA.

DOUG



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com