Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default selecting multiple cell

Gentlemen,

Using VBA, is it posible to select all the cells in column A which their
value fall in between 5 and 10
i.e select all cells in columnA =5 and =< 10


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default selecting multiple cell

Try the following:

Sub SelectCells()
Dim cell As Range
Dim selectedCells As Range
For Each cell In Selection
If cell.Value = 5 And cell.Value <= 10 Then
If selectedCells Is Nothing Then
Set selectedCells = cell
Else
Set selectedCells = Union(selectedCells, cell)
End If
End If
Next
If selectedCells Is Nothing Then
MsgBox "No cells between 5 and 10 found"
Else
selectedCells.Select
End If
End Sub

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Olamide" wrote in message
...
Gentlemen,

Using VBA, is it posible to select all the cells in column A which their
value fall in between 5 and 10
i.e select all cells in columnA =5 and =< 10




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
Selecting specific numbers from a cell containing multiple numbers JRD Excel Worksheet Functions 3 January 18th 09 12:32 AM
multiple row selecting climate Excel Worksheet Functions 3 October 23rd 08 01:26 PM
MS Excel 2007 highlights multiple cells when selecting single cell biz_kid1 Excel Discussion (Misc queries) 5 September 14th 08 06:42 PM
Selecting from drop down list enters multiple cell data DebbieV Excel Worksheet Functions 5 January 21st 08 01:39 PM
selecting multiple cell in a roll that falls withing a range Olamide Charts and Charting in Excel 1 March 15th 07 01:43 PM


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