ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with macro (https://www.excelbanter.com/excel-programming/385269-help-macro.html)

hannatrip

help with macro
 
I would like to make a macro with the following formula
=IF(C3="","",((40-((C3-(TODAY())))/7)))
it needs to calculate a gestational age when the due date is put in from L5
to L169..

I cant seem to get it to lock so the formula doesnt get deleted so I thought
a macro would work??

joel

help with macro
 
I got it to work with no changes. Before putting the formula into worksheet
make sure C3 is empty. Highlight the cell where you want the formula and
then paste the forula at the top of the worksheet in the fx box (formmula
box). It shuold work.

"hannatrip" wrote:

I would like to make a macro with the following formula
=IF(C3="","",((40-((C3-(TODAY())))/7)))
it needs to calculate a gestational age when the due date is put in from L5
to L169..

I cant seem to get it to lock so the formula doesnt get deleted so I thought
a macro would work??


hannatrip

help with macro
 
it works that way, but i cant get it to lock and im afraid when one of the
unit clerks makes a mistake and deletes it it will lose it all. orr what am I
doing wrong in locking the cell with the formula in it??

"Joel" wrote:

I got it to work with no changes. Before putting the formula into worksheet
make sure C3 is empty. Highlight the cell where you want the formula and
then paste the forula at the top of the worksheet in the fx box (formmula
box). It shuold work.

"hannatrip" wrote:

I would like to make a macro with the following formula
=IF(C3="","",((40-((C3-(TODAY())))/7)))
it needs to calculate a gestational age when the due date is put in from L5
to L169..

I cant seem to get it to lock so the formula doesnt get deleted so I thought
a macro would work??


joel

help with macro
 
This function gave me the same answerr as the worksheett function

Function GetGest(cell As Range)

If IsEmpty(cell) Then
GetGest = ""
Else

GetGest = 40 - ((cell - Date) / 7)

End If

End Function




"hannatrip" wrote:

it works that way, but i cant get it to lock and im afraid when one of the
unit clerks makes a mistake and deletes it it will lose it all. orr what am I
doing wrong in locking the cell with the formula in it??

"Joel" wrote:

I got it to work with no changes. Before putting the formula into worksheet
make sure C3 is empty. Highlight the cell where you want the formula and
then paste the forula at the top of the worksheet in the fx box (formmula
box). It shuold work.

"hannatrip" wrote:

I would like to make a macro with the following formula
=IF(C3="","",((40-((C3-(TODAY())))/7)))
it needs to calculate a gestational age when the due date is put in from L5
to L169..

I cant seem to get it to lock so the formula doesnt get deleted so I thought
a macro would work??


Gord Dibben

help with macro
 
By default, all cells are protected when sheet protection is enabled.

Hit CTRL + a(twice in 2003) to select all cells.

FormatCellsProtection. Uncheck "locked"

Select the cells you want protected and FormatCellsProtection

Check "locked".

ToolsProtectionProtect Sheet. Note the options when protecting.

Supply a password and OK.

Excel's internal security is weak but this will prevent overwriting by accident.


Gord Dibben MS Excel MVP

On Wed, 14 Mar 2007 11:51:32 -0700, hannatrip
wrote:

it works that way, but i cant get it to lock and im afraid when one of the
unit clerks makes a mistake and deletes it it will lose it all. orr what am I
doing wrong in locking the cell with the formula in it??

"Joel" wrote:

I got it to work with no changes. Before putting the formula into worksheet
make sure C3 is empty. Highlight the cell where you want the formula and
then paste the forula at the top of the worksheet in the fx box (formmula
box). It shuold work.

"hannatrip" wrote:

I would like to make a macro with the following formula
=IF(C3="","",((40-((C3-(TODAY())))/7)))
it needs to calculate a gestational age when the due date is put in from L5
to L169..

I cant seem to get it to lock so the formula doesnt get deleted so I thought
a macro would work??



hannatrip

help with macro
 
Thank you!!

"Joel" wrote:

This function gave me the same answerr as the worksheett function

Function GetGest(cell As Range)

If IsEmpty(cell) Then
GetGest = ""
Else

GetGest = 40 - ((cell - Date) / 7)

End If

End Function




"hannatrip" wrote:

it works that way, but i cant get it to lock and im afraid when one of the
unit clerks makes a mistake and deletes it it will lose it all. orr what am I
doing wrong in locking the cell with the formula in it??

"Joel" wrote:

I got it to work with no changes. Before putting the formula into worksheet
make sure C3 is empty. Highlight the cell where you want the formula and
then paste the forula at the top of the worksheet in the fx box (formmula
box). It shuold work.

"hannatrip" wrote:

I would like to make a macro with the following formula
=IF(C3="","",((40-((C3-(TODAY())))/7)))
it needs to calculate a gestational age when the due date is put in from L5
to L169..

I cant seem to get it to lock so the formula doesnt get deleted so I thought
a macro would work??


hannatrip

help with macro
 
Thanks you, I finally got it to work!

"Gord Dibben" wrote:

By default, all cells are protected when sheet protection is enabled.

Hit CTRL + a(twice in 2003) to select all cells.

FormatCellsProtection. Uncheck "locked"

Select the cells you want protected and FormatCellsProtection

Check "locked".

ToolsProtectionProtect Sheet. Note the options when protecting.

Supply a password and OK.

Excel's internal security is weak but this will prevent overwriting by accident.


Gord Dibben MS Excel MVP

On Wed, 14 Mar 2007 11:51:32 -0700, hannatrip
wrote:

it works that way, but i cant get it to lock and im afraid when one of the
unit clerks makes a mistake and deletes it it will lose it all. orr what am I
doing wrong in locking the cell with the formula in it??

"Joel" wrote:

I got it to work with no changes. Before putting the formula into worksheet
make sure C3 is empty. Highlight the cell where you want the formula and
then paste the forula at the top of the worksheet in the fx box (formmula
box). It shuold work.

"hannatrip" wrote:

I would like to make a macro with the following formula
=IF(C3="","",((40-((C3-(TODAY())))/7)))
it needs to calculate a gestational age when the due date is put in from L5
to L169..

I cant seem to get it to lock so the formula doesnt get deleted so I thought
a macro would work??





All times are GMT +1. The time now is 06:53 AM.

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