LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default searching for a range of dates

Hello

I have a problem. I have a list of dates in column 'A' and need to
find and display all the dates within a range, say all date from
01/03/2004 to 08/03/2004. the following code works, but it does not
when I try and have the user enter the dates from a user form.

Sub test()
startdate = "03/03/2004"
enddate = "08/03/2004"
Worksheets("sheet1").Activate
For i = 1 To 19
If (startdate <= Worksheets("sheet1").Cells(i, 1).Text) And _
(enddate = Worksheets("sheet1").Cells(i, 1).Text) Then
'go here
Debug.Print Worksheets("sheet1").Cells(i, 1).Text

Else
' go here

End If
Next i


End Sub


the actual code in the workbook look like this, any help would be
appreciated.

UserForm3.Show ' user form to get start and end date range

'wkrpstartdate this is the start date
'wkrpenddate this is the end date
Workbooks("sdrdata.xls").Worksheets("tempreport"). Activate

Workbooks("sdrdata.xls").Worksheets("tempreport"). Cells(1, 1) =
"Servers Installed on dates " + CStr(wkrpstartdate) + " To " +
CStr(wkrpenddate)

Workbooks("sdrdata.xls").Worksheets("Serverlist"). Activate
LastRowServer = Cells.SpecialCells(xlLastCell).Row

For RowP = 2 To LastRowServer
If (<= CStr(wkrpstartdate) <=
CStr(Workbooks("sdrdata.xls").Worksheets("serverli st").Cells(RowP,
10))) And (CStr(wkrpenddate) =
CStr(Workbooks("sdrdata.xls").Worksheets("serverli st").Cells(RowP,
10))) Then
' select row and past to tempreport sheet
ActiveCell.EntireRow.Select
Selection.Copy
Workbooks("sdrdata.xls").Worksheets("tempreport"). Activate
LastRowtempreport = Cells.SpecialCells(xlLastCell).Row
Cells(LastRowtempreport + 1, 1).Activate
ActiveSheet.Paste
Workbooks("sdrdata.xls").Worksheets("serverlist"). Activate
End If

Next RowP
 
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
searching between dates Joe@Willscot Excel Worksheet Functions 4 February 10th 09 02:44 PM
SEARCHING RANGE Mickey Mouse[_3_] Excel Discussion (Misc queries) 4 April 12th 08 05:19 AM
Searching on Dates nmtexman Excel Worksheet Functions 5 June 22nd 06 07:37 PM
searching a range for a sum... chickenshed_bob Excel Worksheet Functions 4 March 30th 06 08:49 PM
3d range searching thephoenix12 Excel Discussion (Misc queries) 0 June 15th 05 06:18 PM


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