Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Identify unprotected cells in protected sheet and clear their cont | Excel Programming | |||
Macro to clear contents of unprotected cells AND drop down boxes | Excel Discussion (Misc queries) | |||
clear contents cells of unprotected cells | Excel Programming | |||
Clear contents of unprotected cells in entire workbook with a macr | Excel Programming | |||
Create a button to Clear Cells | Excel Discussion (Misc queries) |