#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy


Dear Friends,

I have a table with three col . Col A contains Date values Col B and
have other numeric data. I would like to copy from specific date rang
and then paste into sheet2 using userForm having combobox1 "From Date
and Combobox2 "To Date." and when we click the OK botton the specifi
data will copy into sheet2.

Please Code for the above.

Thanks and Regards,

Syed Haider Al

--
Syed Haider Al
-----------------------------------------------------------------------
Syed Haider Ali's Profile: http://www.excelforum.com/member.php...fo&userid=2199
View this thread: http://www.excelforum.com/showthread.php?threadid=51695

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy

Assume the data is on Sheet1 with a header row on row1 and the first date in
A2. Further assume the dates are sorted ascending in column A. Assume your
OK commandbutton is named cbtnOK.

Private Sub cbtnOK_click()
Dim rng as Range, rng1 as Range
Dim rng2 as Range, res as Variant
Dim res1 as Variant
with worksheets("Sheet1")
set rng = .range(.cells(2,1),.cells(2,1).End(xldown))

res = Application.Match(clng(cdate(Combobox1.Text)), rng, 0)
res1 = Application.Match(clng(cdate(Combobox2.Text)), rng, 0)
set rng1 = rng(res)
set rng2 = rng(res1)
.Range(rng1,rng2).Resize(,3).Copy _
worksheets("Sheet2").Cells(rows.count,1).End(xlup) (2)
End With
End sub

--
Regards,
Tom Ogilvy

"Syed Haider Ali"
<Syed.Haider.Ali.23wi0a_1141065303.8529@excelfor um-nospam.com wrote in
message news:Syed.Haider.Ali.23wi0a_1141065303.8529@excelf orum-nospam.com...

Dear Friends,

I have a table with three col . Col A contains Date values Col B and C
have other numeric data. I would like to copy from specific date range
and then paste into sheet2 using userForm having combobox1 "From Date"
and Combobox2 "To Date." and when we click the OK botton the specific
data will copy into sheet2.

Please Code for the above.

Thanks and Regards,

Syed Haider Ali


--
Syed Haider Ali
------------------------------------------------------------------------
Syed Haider Ali's Profile:

http://www.excelforum.com/member.php...o&userid=21994
View this thread: http://www.excelforum.com/showthread...hreadid=516951



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy

That also assumed that each row would have a unique date.

another approach, perhaps simple would be

.Range(rng(Combobox1.ListIndex + 1), _
rng(Combobox2.ListIndex + 1)).Resize(,3).Copy _
Destination:=Worksheets("Sheet2") _
.Cells(rows.count,1).End(xlup)(2)


The original code can be adjusted to handle non unique dates if the dates
are ordered.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Assume the data is on Sheet1 with a header row on row1 and the first date

in
A2. Further assume the dates are sorted ascending in column A. Assume

your
OK commandbutton is named cbtnOK.

Private Sub cbtnOK_click()
Dim rng as Range, rng1 as Range
Dim rng2 as Range, res as Variant
Dim res1 as Variant
with worksheets("Sheet1")
set rng = .range(.cells(2,1),.cells(2,1).End(xldown))

res = Application.Match(clng(cdate(Combobox1.Text)), rng, 0)
res1 = Application.Match(clng(cdate(Combobox2.Text)), rng, 0)
set rng1 = rng(res)
set rng2 = rng(res1)
.Range(rng1,rng2).Resize(,3).Copy _
worksheets("Sheet2").Cells(rows.count,1).End(xlup) (2)
End With
End sub

--
Regards,
Tom Ogilvy

"Syed Haider Ali"
<Syed.Haider.Ali.23wi0a_1141065303.8529@excelfor um-nospam.com wrote in
message

news:Syed.Haider.Ali.23wi0a_1141065303.8529@excelf orum-nospam.com...

Dear Friends,

I have a table with three col . Col A contains Date values Col B and C
have other numeric data. I would like to copy from specific date range
and then paste into sheet2 using userForm having combobox1 "From Date"
and Combobox2 "To Date." and when we click the OK botton the specific
data will copy into sheet2.

Please Code for the above.

Thanks and Regards,

Syed Haider Ali


--
Syed Haider Ali
------------------------------------------------------------------------
Syed Haider Ali's Profile:

http://www.excelforum.com/member.php...o&userid=21994
View this thread:

http://www.excelforum.com/showthread...hreadid=516951





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
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
copy formulas from a contiguous range to a safe place and copy them back later Lucas Budlong Excel Programming 2 February 22nd 06 08:26 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM


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