![]() |
clear data from selected cells
Hello, I have a excel tempate for compiling data. How do I add a Control
button to clear data in unprotected cells only? Can you help? Steve |
clear data from selected cells
I assume you are looking of code and not how to add a button to a sheet
for each cell in Activesheet.UsedRange if cell.Locked = False then cell.ClearContents end if Next -- Regards, Tom Ogilvy "Steve" wrote in message ... Hello, I have a excel tempate for compiling data. How do I add a Control button to clear data in unprotected cells only? Can you help? Steve |
clear data from selected cells
Hi Tom,
Yes, I already have a macro and button. I added protected cells to range, I can't seem to edit the macro without errors. Current macros: Sub clear() ' ' clear Macro ' Macro recorded 1/15/2006 by steve smith ' ' Range("B2:G10").Select Range("B2").Activate Selection.ClearContents End Sub I am fairly new to VB. Thank You, Steve "Tom Ogilvy" wrote: I assume you are looking of code and not how to add a button to a sheet for each cell in Activesheet.UsedRange if cell.Locked = False then cell.ClearContents end if Next -- Regards, Tom Ogilvy "Steve" wrote in message ... Hello, I have a excel tempate for compiling data. How do I add a Control button to clear data in unprotected cells only? Can you help? Steve |
clear data from selected cells
Sub clear()
' ' clear Macro ' Macro recorded 1/15/2006 by steve smith ' ' Dim cell as Range Range("B2:G10").Select Range("B2").Activate for each cell in selection if cell.locked = false then cell.ClearContents end if Next End Sub should work I would think. -- Regards, Tom Ogilvy "Steve" wrote in message ... Hi Tom, Yes, I already have a macro and button. I added protected cells to range, I can't seem to edit the macro without errors. Current macros: Sub clear() ' ' clear Macro ' Macro recorded 1/15/2006 by steve smith ' ' Range("B2:G10").Select Range("B2").Activate Selection.ClearContents End Sub I am fairly new to VB. Thank You, Steve "Tom Ogilvy" wrote: I assume you are looking of code and not how to add a button to a sheet for each cell in Activesheet.UsedRange if cell.Locked = False then cell.ClearContents end if Next -- Regards, Tom Ogilvy "Steve" wrote in message ... Hello, I have a excel tempate for compiling data. How do I add a Control button to clear data in unprotected cells only? Can you help? Steve |
All times are GMT +1. The time now is 05:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com