Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default show all rows containing a date between x and y?

i have some tables, each table has 9 columns and columns 6 and 7 ar
'start date' and 'finish date'.

What i want to do is let someone type in a date (in a text box) an
then have it show all the rows where the date they typed in is betwee
the start and finish date for that row.

not sure if its possible to do this with autofilter but if it is the
that would probably be the best way

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
aa aa is offline
external usenet poster
 
Posts: 3
Default

Hi,

you could try and use your two textboxes and then for your
autofilter text try and use ...

= textbox1


or <= textbox2

luckely autofilter will allow easy manipulation!

thank you
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default show all rows containing a date between x and y?

If you input the dates in a worksheet cell, you could use Conditional
Formatting to highlight matches.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"neowok " wrote in message
...
i have some tables, each table has 9 columns and columns 6 and 7 are
'start date' and 'finish date'.

What i want to do is let someone type in a date (in a text box) and
then have it show all the rows where the date they typed in is between
the start and finish date for that row.

not sure if its possible to do this with autofilter but if it is then
that would probably be the best way.


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default show all rows containing a date between x and y?

doesnt work, maybe because the textbox is just text and the columns ar
defined as proper dates? i typed the text in the same dd-mmm-yy forma
as the dates in the columns but it still came up with nothing.

thinking about it, more what i need is the user specifies ONE date, an
it shows all rows where that date falls between the start and finis
column's dates.

so id need to run autofilter for date = start and then run it again o
the filtered list to filter it down to <= finish, which should the
give all rows where the date specified falls between the start an
finish date on that row.

hmm

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
aa aa is offline
external usenet poster
 
Posts: 3
Default show all rows containing a date between x and y?

Try this in your macro

Selection.AutoFilter Field:=1, Criteria1:="<date",
Operator:=xlAnd
Selection.AutoFilter Field:=2, Criteria1:="date",
Operator:=xlAnd

where the criteria will relate to a textbox1...

i.e.
criteria1:=<textbox1

may work!!!

Neo


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default show all rows containing a date between x and y?

doesnt work, dont know what its doing but its listing ALL rows
regardless of what i type in the box, even if i just use one column and
remove <=* and just autofilter with the textbox value as the criteria,
which should then just list any rows with exactly that criteria, and it
doesnt.

probably because the textbox is text, and the 2 columns are a date.


---
Message posted from http://www.ExcelForum.com/

  #7   Report Post  
Posted to microsoft.public.excel.programming
aa aa is offline
external usenet poster
 
Posts: 3
Default show all rows containing a date between x and y?

why not try,

textbox1_afterupdate()

and if you are referencing to a textbox use the .value
option!!!

Neo
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default show all rows containing a date between x and y?

Selection.AutoFilter Field:=1, Criteria1:="" & cdate(Textbox1.text), _
Operator:=xlAnd
Selection.AutoFilter Field:=2, Criteria1:="<", cDate(Textbox2.text), _
Operator:=xlAnd

cDate should respect your regional settings - VBA by itself does not - it is
US centric and will intepret a date as mm/dd/yyyy if it can.

--
Regards,
Tom Ogilvy


"neowok " wrote in message
...
doesnt work, dont know what its doing but its listing ALL rows
regardless of what i type in the box, even if i just use one column and
remove <=* and just autofilter with the textbox value as the criteria,
which should then just list any rows with exactly that criteria, and it
doesnt.

probably because the textbox is text, and the 2 columns are a date.


---
Message posted from http://www.ExcelForum.com/



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default show all rows containing a date between x and y?

Try this. It will allow you to search a column and return the address of each cell that contains the search string

With Worksheets("Sheet1").Range("A1:A65536"
Set oCell = .Find(what:=TextBox1.Text, lookat:=xlPart
If Not oCell Is Nothing The
sfirst = oCell.Addres
D
Set oCell = .FindNext(oCell
Loop While Not oCell Is Nothing And oCell.Address < sfirs
End I
End With
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
Need help with a project sheet, need date to show/not show based o Max Excel Discussion (Misc queries) 4 December 8th 09 11:01 PM
How to show date in H2 based on date in I2 minus set number of day jt24 Excel Discussion (Misc queries) 2 January 9th 08 12:37 PM
Date subtraction -How to not show negative when 2nd date not entered Edward[_2_] New Users to Excel 2 September 27th 07 03:03 PM
Hide Rows - copy and paste only rows that show Access101 Excel Worksheet Functions 3 March 1st 06 12:39 AM
Pivot Tables: How do I show ALL field rows, including empty rows?? [email protected] Excel Worksheet Functions 2 April 8th 05 06:21 PM


All times are GMT +1. The time now is 04:12 AM.

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"