Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Macro lock/unlock and Auto Filter script issues

I made a Order form for a friend that knows very little about excel, so I
locked all cells that had any formulas in case she deletes them and then the
page would not calculate correctly( She already has deleted some formulas
before).
I created these 2 Radio buttons that basically will make some cells change
the text and run a macro, where this macro will hide a column and change
color in cells ("B2:G2"). Also I need to have the Auto filter running so as
to filter all "NonBlanks". I have password protected and lock ("B2:G2") and
the column E:E (and many others, but theses are the ones affected when
running the macro) So when I run one of the macros in the radio buttons to
hide column E:E and change the color to yellow/blue then of course I get an
msgbox saying those cells are lock and cant be changed.
To solve the problem of running the AutoFilter in Excel 2000 wile cells are
locked, I used this formula I found from Tom Ogilvy and alter to make it
work in my sheet, it works great!
Private Sub Workbook_Open()
'check for filter, turn on if none exists
With Worksheets("Estimate")
If Not .AutoFilterMode Then
.Range("B4:B500").AutoFilter
End If
.EnableAutoFilter = True
.Protect password:="", _
Contents:=True, UserInterfaceOnly:=True
End With
End Sub
----------------------------------------------
THE PROBLEM is when I try to run these macros bellow, I still get the
messages of not been able to change because the cells are locked.
The macros a
Sub ClientEstimate()
' Hides the cost of the materials
ActiveSheet.Unprotect
Columns("E:E").EntireColumn.Hidden = True
Range("B2:G2").Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
.PatternColorIndex = 2
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios
_
:=False 'Re-protect Sheet
End With
End Sub
----------------------------------------------------------------------------
------
Sub Estimate()
ActiveSheet.Unprotect
Columns("E:E").EntireColumn.Hidden = False
Range("B2:G2").Select
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
.PatternColorIndex = 2
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios _
:=False 'Re-protect Sheet
End With
End Sub
-----------------------------------------------------------------
Thank you for all your help

Kevin Brenner


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.708 / Virus Database: 464 - Release Date: 6/18/2004


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro lock/unlock and Auto Filter script issues

after this
range("B2:g22").Select
add this

*Selection.Locked = False

--
Message posted from http://www.ExcelForum.com

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 unlock and lock cells in password protected sheet Chris Excel Discussion (Misc queries) 3 February 26th 10 09:06 PM
Auto Filter Issues gb_S49 Excel Discussion (Misc queries) 3 January 8th 09 10:46 AM
Auto Filter Issues Mike Excel Discussion (Misc queries) 1 March 28th 07 12:17 AM
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. Daniel Excel Worksheet Functions 1 June 24th 05 02:59 PM
Lock or Unlock cell references in a formula for auto fill purposes David P. Excel Discussion (Misc queries) 2 June 6th 05 11:18 PM


All times are GMT +1. The time now is 06:18 AM.

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"