Lock font size

bassls

Board Regular
Joined
Jun 4, 2003
Messages
63
I want to allow users to change data in a cell(s), but prevent them from changing the font, size, style, or anything else. Would creating a form be best?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
select sheet and choose cell who you want to lock fount size
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("a1").Select
Selection.Font.Size = 12
End Sub
 
Upvote 0
I got the font size to work. I need to be able to lock the font name = arial and style = bold. This is what i have:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("a1:a10").Select
Selection.Font.Size = 24
Selection.Font.Name = arial
Selection.Font.Bold = True

End Sub


this still allows the font to be something other than arial.
 
Upvote 0
There is no event associated with formatting cells.

The only workaround I can think of is to use a dynamic loop or better still a timer that would kick off when selecting the target range and periodically monitor the Range formatting.

You could also use the Ontime Method to run every 1 second.
 
Upvote 0
ok a better idea just occured to me.

You could use the Selection change event to kick off some code that would unlock the target range cells and protect the worksheet hence not permitting any formatting changes yet allowing editing. Then when leaving the range unprotect the worksheet back again.
 
Upvote 0
?? I am very inexperienced in programming, and don't understand most of your 2 posts. Couuld you explain further?
 
Upvote 0
If your users find a different font and size more readable, why argue with them?
Letting them change the font only helps your spreadsheet work better. (i.e. it allows a better interface between your workbook and the bio-engineered I/O component.)

If its really really important, you could write a Workbook_Open routine to set the format to the standard you want and then allow them to make stuff readable for their eyes.

I am forever increasing the font sizes that insane youngsters think is readable.
 
Last edited:
Upvote 0
The reason for locking the font is this file is only used to print 1 x 4 labels. The users, for some reason, think that some wierd font blown up to size 40 looks cool. However, this can make the label unreadable, or unprintable. The only thing they need to do is put in today's date, their initials, and sometimes an expiration date. That is why I thought initially a form might work for this aplication.
 
Upvote 0
Since I am not sure what the actual data layout looks like, this is a shot in the dark...

How about looking into the beforePrint() event? You can allow them to change everything all they want, then just before printing run a block of code similar to what you have to format all of it back to 12 point Arial...

It will probably irritate some users who want 40 point font, but oh well...


hth
Al
 
Upvote 0

Forum statistics

Threads
1,223,707
Messages
6,174,000
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top