![]() |
select particular cells
hi there folks!!!!!
i have this problem. i have an excel workshhet and in column E i have the word "JOHN" appearing in 11 cells of this column. "JOHN" appears in E11, E56, E34 etc. i want the user to select only those cells that contain the word"JOHN". he does that by pressing ctrl button plus he clicks with the mouse on the particular cells i want to write a macro that i can check that the user has clicked on those cells containing the word "JOHN" and no other cells and that the cells are currently selected(means that the user has selected the right cells and then leave them selected) thanks alot ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
select particular cells
Nikoloas,
try something like this, to check the value of every cell in teh curretnly selected region: Sub IsItJohn() dim NotJohn as Boolean Dim Cl as Range NotJohn = False For Each cl in Selection.Cells If Ucase(cl.value) < "JOHN" Then NotJohn = True End If Next cl If NotJohn = True then ... code when there are other values in the selection ELSE ... code for no other values in selection End if End Sub -----Original Message----- hi there folks!!!!! i have this problem. i have an excel workshhet and in column E i have the word "JOHN" appearing in 11 cells of this column. "JOHN" appears in E11, E56, E34 etc. i want the user to select only those cells that contain the word"JOHN". he does that by pressing ctrl button plus he clicks with the mouse on the particular cells i want to write a macro that i can check that the user has clicked on those cells containing the word "JOHN" and no other cells and that the cells are currently selected(means that the user has selected the right cells and then leave them selected) |
All times are GMT +1. The time now is 01:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com