Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Extract data from one range and place in the same sheet

Col A-------------------Col B------------------ColC---------------------------
Col D-----------------------ColE
Name-------------------Date-------------------Amount----------------------"
Mary"-------------------- Apr-09
John------------------01-Apr-09--------------$100 ------------------------
01-Apr-09---------------$125
Mary------------------01-Apr-09--------------$125-----------------------------
02-Apr-09---------------$567
Raj--------------------02-Apr-09---------------$50----------------------------
--04-Apr-09---------------$321
Mary------------------02-Apr-09---------------$567
John-------------------03-Apr-09---------------$213
Bill--------------------03-Apr-09----------------$456
Mary-----------------04-Apr-09-------------------$321
Cathy----------------06-Apr-09---------------$310
Mary------------------01-May-09--------------$78
Raj---------------------02-May-09--------------$567

D1 has dropdown list of Names,and E1 has drop down list of Mon-YY.
I need a macro code to get Mary's Apr-09 data from the used range A1:C to
D2:E32.
If I select Mary(cell D1) and Apr-099Cell E1) ,the output should display like
above.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Extract data from one range and place in the same sheet


tkraju, your data hasn't travelled well it seems, do you just want to
retrieve data from columns D:E32 for every instance of Apr-09?, could
you explain a little more clearly?

tkraju via OfficeKB.com;304223 Wrote:
Col A-------------------Col
B------------------ColC---------------------------
Col D-----------------------ColE
Name-------------------Date-------------------Amount----------------------"
Mary"-------------------- Apr-09
John------------------01-Apr-09--------------$100
------------------------
01-Apr-09---------------$125
Mary------------------01-Apr-09--------------$125-----------------------------
02-Apr-09---------------$567
Raj--------------------02-Apr-09---------------$50----------------------------
--04-Apr-09---------------$321
Mary------------------02-Apr-09---------------$567
John-------------------03-Apr-09---------------$213
Bill--------------------03-Apr-09----------------$456
Mary-----------------04-Apr-09-------------------$321
Cathy----------------06-Apr-09---------------$310
Mary------------------01-May-09--------------$78
Raj---------------------02-May-09--------------$567

D1 has dropdown list of Names,and E1 has drop down list of Mon-YY.
I need a macro code to get Mary's Apr-09 data from the used range A1:C
to
D2:E32.
If I select Mary(cell D1) and Apr-099Cell E1) ,the output should
display like
above.

--
Message posted via OfficeKB.com
'Excel - programming Excel using VBA or XLM macros'
(http://www.officekb.com/Uwe/Forums.a...mming/200904/1)



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=85079

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Extract data from one range and place in the same sheet

Hi Simon,
Col A to Col c ,the database is updated daily thus the sales figures in Col c
are added every time date wise( col b) and sales man wise(Col a).I want to
create a report salesman wise ,datewise how much sales done by salesman in a
month.If i put salesman name in D1 and enter Jan-2009 in E1,the detailed
datewise figures of that salesman for the month of Jan-09 be displayed from
D2:E32.



Simon Lloyd wrote:
tkraju, your data hasn't travelled well it seems, do you just want to
retrieve data from columns D:E32 for every instance of Apr-09?, could
you explain a little more clearly?

tkraju via OfficeKB.com;304223 Wrote:
Col A-------------------Col
B------------------ColC---------------------------

[quoted text clipped - 28 lines]
'Excel - programming Excel using VBA or XLM macros'
(http://www.officekb.com/Uwe/Forums.a...mming/200904/1)



--
Message posted via http://www.officekb.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Extract data from one range and place in the same sheet

Hi

Try this:

Sub extractData()
Dim sName As String
Dim dDate As Date
Dim Ammount As Double
Dim LastRow As Long
Dim off As Long

LastRow = Range("A" & Rows.Count).End(xlUp).Row
sName = Range("D1").Value
dDate = Range("E1").Value
For r = 2 To LastRow
If Format(Cells(r, 2), "mm-yy") = Format(dDate, "mm-yy") Then
If Cells(r, 1).Value = sName Then
Cells(r, 2).Resize(1, 2).Copy Cells(2 + off, "D")
off = off + 1
End If
End If
Next
End Sub

Regards,
Per

On 12 Apr., 05:22, "tkraju via OfficeKB.com" <u16627@uwe wrote:
Hi Simon,
Col A to Col c ,the database is updated daily thus the sales figures in Col c
are added every time date wise( col b) and sales man wise(Col a).I want *to
create a report salesman wise ,datewise how much sales done by salesman in a
month.If i put salesman name in D1 and enter Jan-2009 in E1,the detailed
datewise figures of that salesman for the month of Jan-09 be displayed from
D2:E32.

Simon Lloyd wrote:
tkraju, your data hasn't travelled well it seems, do you just want to
retrieve data from columns D:E32 for every instance of Apr-09?, could
you explain a little more clearly?


tkraju via OfficeKB.com;304223 Wrote:
Col A-------------------Col
B------------------ColC---------------------------

[quoted text clipped - 28 lines]
'Excel - programming Excel using VBA or XLM macros'
(http://www.officekb.com/Uwe/Forums.a...mming/200904/1)


--
Message posted viahttp://www.officekb.com


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Extract data from one range and place in the same sheet

Thank You Per Jessen, It gave me perfect results.
I am curious to learn ,what activity happens line by line when this sub runs?
Can you please explain me?I am just new to vba.

Per Jessen wrote:
Hi

Try this:

Sub extractData()
Dim sName As String
Dim dDate As Date
Dim Ammount As Double
Dim LastRow As Long
Dim off As Long

LastRow = Range("A" & Rows.Count).End(xlUp).Row
sName = Range("D1").Value
dDate = Range("E1").Value
For r = 2 To LastRow
If Format(Cells(r, 2), "mm-yy") = Format(dDate, "mm-yy") Then
If Cells(r, 1).Value = sName Then
Cells(r, 2).Resize(1, 2).Copy Cells(2 + off, "D")
off = off + 1
End If
End If
Next
End Sub

Regards,
Per

Hi Simon,
Col A to Col c ,the database is updated daily thus the sales figures in Col c

[quoted text clipped - 17 lines]
--
Message posted viahttp://www.officekb.com


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Extract data from one range and place in the same sheet

Thank you Per,
If I want data summary(for all salesmen), salesman wise total sales done in a
particular month,how this code will be?
if I enter Jan-09 in cell E1
the output will look like
-----------------------------------
john------Jan-09-----------$678
mary-----jan-09------------$457
Bill--------Jan-09------------$908
thanks
Per Jessen wrote:
Hi

Try this:

Sub extractData()
Dim sName As String
Dim dDate As Date
Dim Ammount As Double
Dim LastRow As Long
Dim off As Long

LastRow = Range("A" & Rows.Count).End(xlUp).Row
sName = Range("D1").Value
dDate = Range("E1").Value
For r = 2 To LastRow
If Format(Cells(r, 2), "mm-yy") = Format(dDate, "mm-yy") Then
If Cells(r, 1).Value = sName Then
Cells(r, 2).Resize(1, 2).Copy Cells(2 + off, "D")
off = off + 1
End If
End If
Next
End Sub

Regards,
Per

Hi Simon,
Col A to Col c ,the database is updated daily thus the sales figures in Col c

[quoted text clipped - 17 lines]
--
Message posted viahttp://www.officekb.com


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1

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
How do I pull data from one sheet and place it in another? Fred Excel Discussion (Misc queries) 7 April 28th 09 02:30 AM
extract data from range,and place in the same sheet tkraju via OfficeKB.com Excel Discussion (Misc queries) 2 April 13th 09 02:40 AM
Grabbing data from 1 sheet to place in another prem New Users to Excel 1 May 3rd 08 12:47 PM
Use a range value in place of sheet name John Wilson Excel Discussion (Misc queries) 1 February 26th 08 08:46 AM
extract data from a random list & place in another ordered list sean8690 Excel Discussion (Misc queries) 1 January 2nd 07 06:06 PM


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