Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting a Range inside a range

Hi,
I can not do this because I want to select the range for build a chart per
year.
That´s why I must keep in a VB "range", all data for the same year.
Best regards
Hernan
escribió en el mensaje
...
Why not just use the built in function of count if and
place it into a hidden (or not)colum of your choice.

something like
=COUNTIF($B$1:$B$371,Totals!C$5)

Here I was looking at colum b from row 1 to row 371 to see
if any matched the date that I had in c5 on my Totals
page. But you can just as easly left it at =COUNTIF
(A1:A500,mm/dd/yy)

-----Original Message-----
Hi
what do you want to do with this selection afterwards?

But one way could be (assumption: column A is sorted

ascending)
sub foo()
dim rng as range
dim row_start as long
dim row_end as long
dim row_index as long
dim lastrow as long
with activesheet
lastrow = .Cells(Rows.count, "A").End(xlUp).row
For row_index = 1 to lastrow
if Year(.cells(row_index,1))=2004 then
row_start=row_index
exit for
end if
next

For row_index = lastrow to row_start step -1
if Year(.cells(row_index,1))=2004 then
row_end=row_index
exit for
end if
next
set rng=.range("B" & row_start & ":B" & row_end)
end with
rng.select
end sub

--
Regards
Frank Kabel
Frankfurt, Germany


hcova wrote:
Hi everybody:
I have the following problem in VBA:
a) I have the column A filled with dates formated

as "mm/dd/yy".
b) In the column B, for every date I have a associated

a certain
integer number.
I want to select a range in column B that contains only

the integers
for a given year.
NOTE: For simplicity I have sorted the column A by date.
How can I do this?
Regards

.



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
How do I insert a dynamic reference of a range inside VLOOKUP? Alexandre Excel Worksheet Functions 4 June 24th 09 03:28 PM
how can i use countif function inside a filtered range jayin New Users to Excel 1 February 24th 09 07:05 AM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Using a range variable inside a excel function Michael Excel Discussion (Misc queries) 2 November 14th 05 02:52 PM
Check if a range is inside another Rafael Sobral Excel Programming 2 January 28th 04 06:10 PM


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