Fixed decimals worksheet specific

G

Guest

I know how to do fixed decimals thru the tools option on the menu, but is
there a way for it to be worksheet specifi? I don't want all my worksheet to
be fixed, just certain ones. Can anyone help?
 
B

Bob Phillips

Private Sub Worksheet_Activate()
Application.FixedDecimal = True
End Sub

Private Sub Worksheet_Deactivate()
Application.FixedDecimal = False
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
G

Gord Dibben

Stick this code into the specific worksheet(s)

Private Sub Worksheet_Activate()
Application.FixedDecimal = True
End Sub

Private Sub Worksheet_Deactivate()
Application.FixedDecimal = False
End Sub

This is event code and goes into the sheet module.

Right-click on a sheet tab and "View Code"

Copy and paste the code into that module.


Gord Dibben MS Excel MVP
 
G

Guest

Ok, I copied and pasted (???) the code to the worksheet. I tried typing in
1231 and wanted it to be 12.31 but it came out 1231.00 (I have the cells
formatted to 2 decimals; not the fixed, just the formatted). Then I tried in
a cell that wasn't formatted and it came out 1231. Did I do something wrong?
 
B

Bob Phillips

Are you sure you pasted it in the same worksheet code module that you
entered the data?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
G

Gord Dibben

And don't forget it is sheet_activate code.

After pasting the code into the module, you must switch to another sheet then
re-select(activate) the sheet to get fixed decimals.


Gord
 
G

Guest

Yep. Checked the code and it's still there. I have only one sheet in the
worksheet. Do I still select "fixed decimal" from the option menu? I got a
message when I went into the sheet saying I encountered an error because of
several security reasons. I went into tools/macro/security and set to
medium. Closed the file and then opened it again and selected "enable", but
still didn't work.

Thanks for the help anyway. Maybe it's something in the file.

Charlotte
 
G

Guest

Thanks, but still didn't work. Got an error when I first went into the file
about security. Tried changing level to medium (as was suggested) then
close, reopen and select enable, but still didn't work.

Must be something about the file or what I'm doing. Thanks anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top