Thanks - Although this works on the entire sheet, How can get this to a
specific range say range I12:I384, I would like to leave the rest of the
sheet untouched. What I am trying to do is assign specific text to a specific
cllumn by creating a button on the top of the column. I tried this but it
doesnot work
Sub MarkGrey()
Range("I12:I384").Select
Dim rCell As Range
For Each rCell In Worksheets("Passive Safety").UsedRange
If Not rCell.Locked Then
rCell.Value = "Gray"
'rcell.ClearContents
End If
Next rCell
End Sub
"Dick Kusleika" wrote:
> On Fri, 1 Aug 2008 08:55:00 -0700, Ram B <(E-Mail Removed)>
> wrote:
>
> >I want to create two buttons, one that will give the unlocked cells in a
> >range H12:H400 the text "Gray" and the other will clear the contents. Any
> >help will be appriciated.
>
> Sub MarkGrey()
>
> Dim rCell As Range
>
> For Each rCell In Sheet1.UsedRange
> If Not rCell.Locked Then
> rCell.Value = "Gray"
> 'rcell.ClearContents
> End If
> Next rCell
>
> End Sub
>
> Make a new sub and change the line to clearcontents for the button to clear.
> --
> Dick Kusleika
> Microsoft MVP-Excel
> http://www.dailydoseofexcel.com
>