Autofil/Create a sub list from a master list

ndnsumr

New Member
Joined
Jun 28, 2010
Messages
3
I have a master list that I use to track all clients, potential and acquired, along with additional details. I want a sublist that is automatically updated/created based on the information added to master list that contains a list of clients based on a certain criteria found in a column in the master list.

The master list has 31 columns, but i am only concerned with 2 to pull my data.
Column A - Client Name
Column G - Effective Date

I want my sublist to list only the Client Name and the Effective Date - ONLY if the Effective date is between 1/1/2010 and 12/31/2010.

I'm IT saavy but i've never worked with macros before. HELP!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Excel Workbook
ABCDEFG
1Client NameStartup/ Takeover (S/T)Proposal Author (Sam/Jenna)Fees/Illus Provided (F/I - Date)Date Svcs ApprovedEffective Date of Client
2Company ATJennaFees06/23/09
3Company BTJennaFees02/16/1003/02/1001/01/10
4Company CTJennaFees06/25/10
5Company DSJennaFees02/24/1002/24/10
6Company ETJennaFees10/09/0711/30/0704/01/10
7Company FTMissyFees11/17/09
8Company GSMissyF/I12/05/0812/09/0812/15/08
9Company HSSam/JennaIllus08/20/0909/08/0909/30/09
10Company ISJennaIllus08/20/0812/24/0803/01/10
11Company JTJennaFees05/15/0805/19/0806/01/09
New Plans
Excel Workbook
AB
3Client NameEffective Date of Client
4Company B01/01/10
5Company E04/01/10
6Company I03/01/10
2010
 
Upvote 0
Hello all, I still would really appreciate some help with this. I have yet to find a solution. Thanks!
 
Upvote 0
ndnsumr,


Sample worksheets before the macro:


Excel Workbook
ABCDEFG
1Client NameStartup/ Takeover (S/T)Proposal Author (Sam/Jenna)Fees/Illus Provided * * * * *(F/I - Date)Date Svcs ApprovedEffective Date of Client
2Company ATJennaFees06/23/09
3Company BTJennaFees02/16/1003/02/1001/01/10
4Company CTJennaFees06/25/10
5Company DSJennaFees02/24/1002/24/10
6Company ETJennaFees10/09/0711/30/0704/01/10
7Company FTMissyFees11/17/09
8Company GSMissyF/I12/05/0812/09/0812/15/08
9Company HSSam/JennaIllus08/20/0909/08/0909/30/09
10Company ISJennaIllus08/20/0812/24/0803/01/10
11Company JTJennaFees05/15/0805/19/0806/01/09
12
New Plans





Excel Workbook
AB
3Client NameEffective Date of Client
4
5
6
7
2010





After the macro:


Excel Workbook
AB
3Client NameEffective Date of Client
4Company B01/01/10
5Company E04/01/10
6Company I03/01/10
7
2010





Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

Adding the Macro
1. Copy the below macro, by highlighting the macro code and pressing the keys CTRL + C
2. Open your workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Paste the code by pressing the keys CTRL + V
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


Code:
Option Explicit
Sub GetClients()
' hiker95, 10/12/2010, ME477573
Dim w1 As Worksheet, w2010 As Worksheet
Dim sDate As Date, eDate As Date
Dim LRN As Long, LR2010 As Long, AFCnt As Long
Application.ScreenUpdating = False
Set w1 = Worksheets("New Plans")
Set w2010 = Worksheets("2010")
sDate = "01/01/10"
eDate = "12/31/10"
w1.AutoFilterMode = False
LRN = w1.Cells(Rows.Count, 1).End(xlUp).Row
With w1.Range("G1:G" & LRN)
  .AutoFilter
  .AutoFilter Field:=1, Criteria1:=">=" & sDate, Operator:=xlAnd, Criteria2:="<=" & eDate
  AFCnt = Application.Subtotal(103, w1.Columns(7))
  If AFCnt > 1 Then
    LR2010 = w2010.Cells(Rows.Count, 1).End(xlUp).Row
    If LR2010 > 3 Then w2010.Range("A4:B" & LR2010).ClearContents
    w1.Range("A1").Offset(1).Resize(.Rows.Count - 1).SpecialCells(12).Copy w2010.Range("A4")
    w1.Range("G1").Offset(1).Resize(.Rows.Count - 1).SpecialCells(12).Copy w2010.Range("B4")
    .AutoFilter
  Else
    .AutoFilter
    w1.Activate
    Application.ScreenUpdating = True
    MsgBox "There are no dates in column G that match your search criteria - macro terminated!"
    Exit Sub
  End If
End With
w2010.Activate
Application.ScreenUpdating = True
End Sub


Then run the GetClients macro.


Each time you run the macro, if there is any data on worksheet 2010 below row 3 in columns A and B, the data will be cleared.

If this is not acceptable, then I can adjust the macro.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top