Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to select rows containing certain date

Hello Guys!
I'm in big trouble. I need to select range containing certain
date value which is enterted to inputbox.

I have 3 columns of data, second column is
date. How would the script look like if I need to select from
these 3 columns range which contains date 23.09.2003 ?

For example I have date 23.09.2003 in rows 30 to 400,
then I would like to select range A30 to C400 and copy
this data to another sheet.

Pleeeeeeeaase help me,
Jessica



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default How to select rows containing certain date

Would it be just as easy to use AutoFilter?

http://www.contextures.com/xlautofilter01.html

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

Hello Guys!
I'm in big trouble. I need to select range containing certain
date value which is enterted to inputbox.

I have 3 columns of data, second column is
date. How would the script look like if I need to select from
these 3 columns range which contains date 23.09.2003 ?

For example I have date 23.09.2003 in rows 30 to 400,
then I would like to select range A30 to C400 and copy
this data to another sheet.

Pleeeeeeeaase help me,
Jessica


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to select rows containing certain date

Thank you Paul,
but I don't want to use autofilter. I want to get the filtered
value from input box, then loop until cursor gets to cell
with value inserted to input box. Then set selection start.
Loop until it gets to the last row with inserted date value
and set selection end.

Waiting for your help,
Jessica



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to select rows containing certain date

Sub copydata1()
Dim sStr As String
Dim dDate As Date
Dim lDate As Long
Dim cell As Range
Dim rng As Range
Dim rng1 As Range
sStr = InputBox("Please enter the date")
If IsDate(sStr) Then
dDate = CDate(sStr)
Else
Exit Sub
End If
lDate = CLng(dDate)
Set rng = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
For Each cell In rng
If cell.Value2 = lDate Then
If Not rng1 Is Nothing Then
Set rng1 = Union(rng1, cell)
Else
Set rng1 = cell
End If
End If
Next
If Not rng1 Is Nothing Then
rng1.Resize(, 3).Copy Destination:=Worksheets("Sheet2").Range("A1")
End If

End Sub

--
Regards,
Tom Ogilvy


"jessica" wrote in message
...
Thank you Paul,
but I don't want to use autofilter. I want to get the filtered
value from input box, then loop until cursor gets to cell
with value inserted to input box. Then set selection start.
Loop until it gets to the last row with inserted date value
and set selection end.

Waiting for your help,
Jessica



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



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
select between rows zana Excel Discussion (Misc queries) 1 May 18th 09 11:56 PM
Cannot select rows in VBA [email protected] Excel Discussion (Misc queries) 1 September 6th 07 04:00 AM
How can i randomly select 780 rows from 4000 rows of data bbb Excel Worksheet Functions 2 July 6th 07 08:21 PM
select rows [email protected] Excel Worksheet Functions 1 March 1st 06 03:57 AM
Unable to select rows in the repeat rows on top option Noppie Excel Discussion (Misc queries) 2 December 28th 04 03:17 PM


All times are GMT +1. The time now is 08:22 PM.

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"