Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everybody
I´ve just pasted the following macro and run it within my worksheet, but an error displays as I have merged cells. Should I consider some additional sentence for that?? (I don't know how works VBA). Sub rob() For each r in activesheet.range("C7:h29").cells if r.locked then else r.clearcontents end if Next End sub Thank you in advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub rob()
For each r in activesheet.range("C7:h29").cells if r.locked then else r.MergeArea.clearcontents end if Next End sub "Tuckland" wrote: Hi everybody I´ve just pasted the following macro and run it within my worksheet, but an error displays as I have merged cells. Should I consider some additional sentence for that?? (I don't know how works VBA). Sub rob() For each r in activesheet.range("C7:h29").cells if r.locked then else r.clearcontents end if Next End sub Thank you in advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tuckland
Just a point this macro doesn't clear the content of unlocked cells. What it does is look if the cell would be locked if the sheet was protected. i.e it looks if the locked box is checked in Format|Cells|protection. Mike "Tuckland" wrote: Hi everybody I´ve just pasted the following macro and run it within my worksheet, but an error displays as I have merged cells. Should I consider some additional sentence for that?? (I don't know how works VBA). Sub rob() For each r in activesheet.range("C7:h29").cells if r.locked then else r.clearcontents end if Next End sub Thank you in advance |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Instead of
r.clearcontents try r.value = "" Tuckland wrote: Hi everybody I´ve just pasted the following macro and run it within my worksheet, but an error displays as I have merged cells. Should I consider some additional sentence for that?? (I don't know how works VBA). Sub rob() For each r in activesheet.range("C7:h29").cells if r.locked then else r.clearcontents end if Next End sub Thank you in advance -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you!
"vbapro" wrote: Sub rob() For each r in activesheet.range("C7:h29").cells if r.locked then else r.MergeArea.clearcontents end if Next End sub "Tuckland" wrote: Hi everybody I´ve just pasted the following macro and run it within my worksheet, but an error displays as I have merged cells. Should I consider some additional sentence for that?? (I don't know how works VBA). Sub rob() For each r in activesheet.range("C7:h29").cells if r.locked then else r.clearcontents end if Next End sub Thank you in advance |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry for not answer you before...
I have checked the macro and as you say it doesn't cover what I really need :-( "Mike H" wrote: Tuckland Just a point this macro doesn't clear the content of unlocked cells. What it does is look if the cell would be locked if the sheet was protected. i.e it looks if the locked box is checked in Format|Cells|protection. Mike "Tuckland" wrote: Hi everybody I´ve just pasted the following macro and run it within my worksheet, but an error displays as I have merged cells. Should I consider some additional sentence for that?? (I don't know how works VBA). Sub rob() For each r in activesheet.range("C7:h29").cells if r.locked then else r.clearcontents end if Next End sub Thank you in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to clear contents of certain cells | Excel Discussion (Misc queries) | |||
clear unlocked cells macro help please | Excel Worksheet Functions | |||
Delete contents unlocked cells | Excel Discussion (Misc queries) | |||
Macro to clear contents of unprotected cells AND drop down boxes | Excel Discussion (Misc queries) | |||
Selecting only unlocked cells to clear | Excel Programming |