Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I was using the following macro to change the number format of a highlighted
range. Selection.NumberFormat = "#,##0" In Excel 97 and 2000 it was working fine. In Excel 2007 it is giving me the following error message: Run-time error '1004' Unable to set the NumberProperty of the range class I am stumped and haven't been able to find any documentation on this change. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is the worksheet protected?
Lauren977 wrote: I was using the following macro to change the number format of a highlighted range. Selection.NumberFormat = "#,##0" In Excel 97 and 2000 it was working fine. In Excel 2007 it is giving me the following error message: Run-time error '1004' Unable to set the NumberProperty of the range class I am stumped and haven't been able to find any documentation on this change. -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dave,
Yes the worksheet is protected, but I am running a routine to remove the protection. This routine is the same as in my other macros and is working the If ActiveSheet.Protect = True Then ActiveSheet.Unprotect Password:="percy" Thanks for getting back to me quickly. Lauren "Dave Peterson" wrote: Is the worksheet protected? Lauren977 wrote: I was using the following macro to change the number format of a highlighted range. Selection.NumberFormat = "#,##0" In Excel 97 and 2000 it was working fine. In Excel 2007 it is giving me the following error message: Run-time error '1004' Unable to set the NumberProperty of the range class I am stumped and haven't been able to find any documentation on this change. -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you want to check for protection, you should use something like:
With ActiveSheet If .ProtectContents = True _ Or .ProtectDrawingObjects = True _ Or .ProtectScenarios = True Then .Unprotect Password:="percy" end if end with But I bet excel will forgive you if you just unprotect it without checking: ActiveSheet.Unprotect Password:="percy" Lauren977 wrote: Hi Dave, Yes the worksheet is protected, but I am running a routine to remove the protection. This routine is the same as in my other macros and is working the If ActiveSheet.Protect = True Then ActiveSheet.Unprotect Password:="percy" Thanks for getting back to me quickly. Lauren "Dave Peterson" wrote: Is the worksheet protected? Lauren977 wrote: I was using the following macro to change the number format of a highlighted range. Selection.NumberFormat = "#,##0" In Excel 97 and 2000 it was working fine. In Excel 2007 it is giving me the following error message: Run-time error '1004' Unable to set the NumberProperty of the range class I am stumped and haven't been able to find any documentation on this change. -- Dave Peterson -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Dave,
That works great! You have saved me a huge amount of trial and error. Lauren "Dave Peterson" wrote: If you want to check for protection, you should use something like: With ActiveSheet If .ProtectContents = True _ Or .ProtectDrawingObjects = True _ Or .ProtectScenarios = True Then .Unprotect Password:="percy" end if end with But I bet excel will forgive you if you just unprotect it without checking: ActiveSheet.Unprotect Password:="percy" Lauren977 wrote: Hi Dave, Yes the worksheet is protected, but I am running a routine to remove the protection. This routine is the same as in my other macros and is working the If ActiveSheet.Protect = True Then ActiveSheet.Unprotect Password:="percy" Thanks for getting back to me quickly. Lauren "Dave Peterson" wrote: Is the worksheet protected? Lauren977 wrote: I was using the following macro to change the number format of a highlighted range. Selection.NumberFormat = "#,##0" In Excel 97 and 2000 it was working fine. In Excel 2007 it is giving me the following error message: Run-time error '1004' Unable to set the NumberProperty of the range class I am stumped and haven't been able to find any documentation on this change. -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do you change the default number format in Excel 2007? | Excel Discussion (Misc queries) | |||
How do I change background color of highlighted Excel range ? | Excel Discussion (Misc queries) | |||
Excel 2007 Record Macro button in Developer tab is not highlighted | Excel Discussion (Misc queries) | |||
*.csv format change if .xlt save as .csv in Excel 2007 | Excel Discussion (Misc queries) | |||
How to count the number of cells highlighted using Conditional Formatting feature present in Format Menu of Excel??? | Excel Programming |