LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default select from a range only some cells

Dim rng as Range, i as Long
for i = 4 to 17
if cells(2,i) = "mon" then
if rng is nothing then
set rng = cells(4,i)
else
set rng = union(rng,cells(4,i))
end if
end if
Next
if not rng is nothing then
rng.select
End if

this assumes the string "mon" is in the cell. If it is a date and you want
to test for monday

if weekday(cells(2,i),Value) = 2 then

--
Regards,
Tom Ogilvy

"hulub" wrote in message
...

i need to select from a range (D4:Q4) (defined as range in vba) only the
cells that verify one condition taken from other range (D2:Q2). In range
D2:Q2 I have week days (mon, thu, etc) witch are repeating and I need to
select only mondays. In the selected cells I have to put some values...
How to do this?
Thank you!


--
hulub
------------------------------------------------------------------------
hulub's Profile:

http://www.excelforum.com/member.php...o&userid=14494
View this thread: http://www.excelforum.com/showthread...hreadid=261996



 
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
Using Popups to select a range of cells. Colin Hayes Excel Discussion (Misc queries) 4 April 9th 10 04:19 PM
Select a range of cells wx4usa Excel Discussion (Misc queries) 2 December 23rd 09 07:32 PM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
Select Range of Cells programmingrookie Excel Discussion (Misc queries) 2 August 11th 05 07:13 PM
select a range using "cells()" fullers Excel Worksheet Functions 2 July 6th 05 06:00 PM


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