Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Create a Clear button to clear unprotected cells

Hello. I spent a while searcing through historical posts for this answer but
I could not get anything suggested to work on my sheet. I think this is more
than likely a pretty easy thing for experienced users (of course not me!) :o)

I have a simple worksheet (no macros, forms etc.). I created a clear button
and when I click on it, I want Cell F3 and range E6 - E 13 (unprotected
cells; the rest of the sheet is protected) to clear and then refocus on cell
F3.

I used the following code on the clear button:

Private Sub ClearButton1_Click()

Dim cell As Range
Range("E6:E13").Select
Range("E6").Activate
For Each cell In Selection
If cell.Locked = False Then
cell.ClearContents
End If
Next
End Sub

How do I get the cell F3 to regain the focus on click?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 373
Default Create a Clear button to clear unprotected cells

How about this? James

Private Sub ClearButton1_Click()
Range("E6:E13").ClearContents
Range("F3").Select
ActiveCell.ClearContents
End Sub

"Jcraig713" wrote in message
...
Hello. I spent a while searcing through historical posts for this answer
but
I could not get anything suggested to work on my sheet. I think this is
more
than likely a pretty easy thing for experienced users (of course not me!)
:o)

I have a simple worksheet (no macros, forms etc.). I created a clear
button
and when I click on it, I want Cell F3 and range E6 - E 13 (unprotected
cells; the rest of the sheet is protected) to clear and then refocus on
cell
F3.

I used the following code on the clear button:

Private Sub ClearButton1_Click()

Dim cell As Range
Range("E6:E13").Select
Range("E6").Activate
For Each cell In Selection
If cell.Locked = False Then
cell.ClearContents
End If
Next
End Sub

How do I get the cell F3 to regain the focus on click?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Create a Clear button to clear unprotected cells

Thanks so much.... I am flying now!

janell

"Zone" wrote:

How about this? James

Private Sub ClearButton1_Click()
Range("E6:E13").ClearContents
Range("F3").Select
ActiveCell.ClearContents
End Sub

"Jcraig713" wrote in message
...
Hello. I spent a while searcing through historical posts for this answer
but
I could not get anything suggested to work on my sheet. I think this is
more
than likely a pretty easy thing for experienced users (of course not me!)
:o)

I have a simple worksheet (no macros, forms etc.). I created a clear
button
and when I click on it, I want Cell F3 and range E6 - E 13 (unprotected
cells; the rest of the sheet is protected) to clear and then refocus on
cell
F3.

I used the following code on the clear button:

Private Sub ClearButton1_Click()

Dim cell As Range
Range("E6:E13").Select
Range("E6").Activate
For Each cell In Selection
If cell.Locked = False Then
cell.ClearContents
End If
Next
End Sub

How do I get the cell F3 to regain the focus on click?




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
Identify unprotected cells in protected sheet and clear their cont NezRhodes Excel Programming 9 September 15th 06 07:26 PM
Macro to clear contents of unprotected cells AND drop down boxes JB2010 Excel Discussion (Misc queries) 3 March 30th 06 10:13 AM
clear contents cells of unprotected cells Ed Excel Programming 6 January 12th 06 06:09 PM
Clear contents of unprotected cells in entire workbook with a macr FinnGirl Excel Programming 1 June 29th 05 05:32 PM
Create a button to Clear Cells tamato43 Excel Discussion (Misc queries) 3 May 16th 05 02:09 AM


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

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

About Us

"It's about Microsoft Excel"