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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
i have protected the whole workbook not the sheets by them self, would that do it?
 
Upvote 0

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
scracth that, not true, only one sheet is protected and its not that
The sheet is set to veryhidden though/...?
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,358
Office Version
  1. 365
Platform
  1. Windows
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

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
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,191,587
Messages
5,987,507
Members
440,098
Latest member
MickyMouse123

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
Top