Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 37
Default clear unlocked cells macro help please

I have the following macro attached to a button on my "Price Estimator"
worksheet trying to clear contents in all of the unlocked cells of the
worksheet. Can someone please help me figure out what is wrong with the
following:

Sub ClearForm()
Dim c As Range
For Each c In Sheets("PRICE ESTIMATOR").UsedRange
If c.Locked = False Then
c.ClearContents
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
lmh lmh is offline
external usenet poster
 
Posts: 9
Default clear unlocked cells macro help please

Is it as simple as missing End If and Next lines?

Sub ClearForm()
Dim c As Range
For Each c In Sheets("PRICE ESTIMATOR").UsedRange
If c.Locked = False Then
c.ClearContents
End If
Next c
End Sub

If that was just typo stuff in your query then maybe all cells are locked
(so nothing to do).
--
LMH


"CandiC" wrote:

I have the following macro attached to a button on my "Price Estimator"
worksheet trying to clear contents in all of the unlocked cells of the
worksheet. Can someone please help me figure out what is wrong with the
following:

Sub ClearForm()
Dim c As Range
For Each c In Sheets("PRICE ESTIMATOR").UsedRange
If c.Locked = False Then
c.ClearContents
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default clear unlocked cells macro help please


Sub ClearForm()
Dim c As Range
For Each c In Sheets("PRICE ESTIMATOR").UsedRange
If c.Locked = False Then c.ClearContents
next c
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CandiC" wrote in message
...
I have the following macro attached to a button on my "Price Estimator"
worksheet trying to clear contents in all of the unlocked cells of the
worksheet. Can someone please help me figure out what is wrong with the
following:

Sub ClearForm()
Dim c As Range
For Each c In Sheets("PRICE ESTIMATOR").UsedRange
If c.Locked = False Then
c.ClearContents
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default clear unlocked cells macro help please

Sub ClearForm()
Dim c As Range
For Each c In Sheets("PRICE ESTIMATOR").UsedRange
If c.Locked = False Then
c.ClearContents
End If
Next c
End Sub


Gord Dibben MS Excel MVP

On Fri, 13 Nov 2009 14:30:01 -0800, CandiC
wrote:

I have the following macro attached to a button on my "Price Estimator"
worksheet trying to clear contents in all of the unlocked cells of the
worksheet. Can someone please help me figure out what is wrong with the
following:

Sub ClearForm()
Dim c As Range
For Each c In Sheets("PRICE ESTIMATOR").UsedRange
If c.Locked = False Then
c.ClearContents
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to clear checkboxes and protected cells Guy[_2_] Excel Worksheet Functions 2 December 29th 08 08:54 PM
clear cells macro Dorothy Excel Discussion (Misc queries) 5 April 7th 08 12:46 AM
macro to clear cells press313 Excel Discussion (Misc queries) 0 May 24th 06 02:31 AM
Moving from unlocked cells to unlocked cells in an excel form Stacey Lee Excel Worksheet Functions 1 April 24th 06 08:44 PM
Macro to clear cells Esrei Excel Discussion (Misc queries) 5 April 19th 05 01:52 PM


All times are GMT +1. The time now is 01:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"