Erorr from this code

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
Hello, this gives me an error, anyone know why?

Range("A" & rowf).Font.Size = 12

rowf = 10 at this point.

Error is that is says it cannot set the size property
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Only reason I could think of is if the sheet is protected.

If so, you can unprotect the sheet - do stuff - reprotect the sheet
Code:
activesheet.unprotect "Password"
Range("A" & rowf).Font.Size = 12
activesheet.protect "Password

If that's not the problem, We'll probably need to see the rest of the code to figure out what's wrong.
 
Upvote 0
i have protected the whole workbook not the sheets by them self, would that do it?
 
Upvote 0
scracth that, not true, only one sheet is protected and its not that
The sheet is set to veryhidden though/...?
 
Upvote 0
Perhaps

Code:
Application.ScreenUpdating = False
Sheets("Sheet1").Hidden = False
Sheets("Sheet1").Range("A" & rowf).Font.Size = 12
Sheets("Sheet1").Hidden = xlVeryHidden
Application.ScreenUpdating = true
 
Upvote 0
sheet hidden will not effect it.

Are you sure protection is not the issue?

Try putting the Unprotect code just before the line that is failing..
 
Upvote 0
Kavy

Why would you want to change the font size in a sheet that isn't visible?

By the way I tested the code on a very hidden worksheet and it appeared to work.:)

Mind you I did include a worksheet reference.:)
 
Upvote 0
Why would you want to change the font size in a sheet that isn't visible?

Ahhh, That is a good question.

But, I think it's time for you to post the whole code Kavy.
 
Upvote 0
sorry guys now its not happing, I can't re-produce it.
I did use the unprotect thing and it did stop around then but it was after the error ...

Sorry to waste you time, i have no idea what happen!
Its a form being printed, thats why I am changing the font of a hiddensheet
(I unhide right b4 printing and hide after)
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,388
Members
448,957
Latest member
Hat4Life

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