LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Lock Certain Cells that Meet Certain Certeria

Hello,

I'm trying to use FOR - NEXT to cycle through the Range B:B or even
better go to the last row (which I don't know how to do successfully -
it always stops short a few rows). I would like to find each cell that
has an "X" and then lock that row or if no "X" leave it unlock.

I have the entire worksheet unlock - so when this runs the only locked
rows are the ones with an "X" in Column B.

Here is my code so far, it locks cell A1 and that's it:

Sub LockCells()

Dim test1 As Range

Set test1 = Range("B2, B150")

For Each test1 In Selection
If test1 = "" Then
ActiveCell.Locked = False
ActiveCell.FormulaHidden = False
Else
ActiveCell.Locked = True
ActiveCell.FormulaHidden = True

End If

Next

End Sub


Many Thanks!!
Dave

 
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
sum cells that meet a specific condition George P Excel Worksheet Functions 1 January 29th 08 03:36 AM
Excel-only average cells if two cells in same row, meet two condit Eulie-Denver Excel Worksheet Functions 5 October 5th 06 11:15 PM
Count Cells that meet Criteria kmason Excel Worksheet Functions 6 August 24th 06 04:31 PM
I want to know how many times 2 corresponding cells meet a conditi talderman Excel Discussion (Misc queries) 6 April 3rd 06 09:48 PM
Adding cells that meet certain criteria PattiP Excel Programming 4 December 14th 05 06:18 PM


All times are GMT +1. The time now is 02:18 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"