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 ranges by dates

I am trying to write the code that will allow me to input date ranges
and copy the information by the date that it was entered.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Selecting ranges by dates


Dim rng as Range, rng1 as Range
Dim ans as String, Target as Long
Dim res as Variant
with worksheets("Sheet1")
set rng = .range(.Cells(2,1),.Cells(2,1).End(xldown))
End with
ans = Inputbox("Enter your date:")
if cdate(ans) then
target = clng(cdate(ans))
res = Application.match(target,rng,0)
if not iserror(res) then
set rng1 = rng(res)
rng1.copy Destination:=worksheets("Sheet2").cells( _
rows.count,1).End(xlup)(2)
else
msgbox ans & " was not found"
end if
else
msgbox ans & " is not a valid date"
end if

--
Regards,
Tom Ogilvy

" wrote:

I am trying to write the code that will allow me to input date ranges
and copy the information by the date that it was entered.


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
Selecting Ranges Barb Reinhardt Excel Programming 3 February 7th 06 07:23 PM
Selecting ranges Steve Wood Excel Programming 1 August 24th 04 02:16 PM
Selecting ranges with a text box Bob Metzler Excel Programming 0 September 22nd 03 04:47 PM
Selecting ranges with a text box Ed[_13_] Excel Programming 1 September 22nd 03 04:47 PM
selecting ranges MDC Excel Programming 1 July 24th 03 03:34 PM


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