![]() |
|
#1
|
|||
|
|||
|
I have a Master worksheet that has both Dallas and Austin listed in the City Column. I tried to use an "if" formula to populate the Dallas worksheet with the row information that shows Dallas as the city and one to also populate the Austin worksheet with all Austin row information.
I am fairly new at Excel so really appreciate your help. This is pretty fabulous to be able to get help from professionals! Thanks!! Short Sample Workbook attached. |
|
#2
|
|||
|
|||
|
Depending on the amount of data you have. If you have a lot, AutoFilter might be better.
Code:
Sub Maybe()
Dim c As Range
For Each c In Range("C2:C" & Cells(Rows.Count, 3).End(xlUp).Row)
c.Offset(, -2).Resize(, 4).Copy Sheets(c.Value).Cells(Rows.Count, 1).End(xlUp).Offset(1)
Next c
End Sub
|
|
#3
|
|||
|
|||
|
If you do not have an awful lot of data you might want to try an array formula.
Please note that Master!A2 5 is named d and Master!C2:C5 is named City.
|
|
#4
|
|||
|
|||
|
This might be faster if you have a large amount of data.
See attached Code:
Sub With_AutoFilter()
Dim cityArr, i As Long
cityArr = Array("Dallas", "Austin")
Application.ScreenUpdating = False
With Range("A1").CurrentRegion
For i = LBound(cityArr) To UBound(cityArr)
.AutoFilter Field:=3, Criteria1:=cityArr(i)
.Offset(1).Copy Sheets(cityArr(i)).Cells(Rows.Count, 1).End(xlUp).Offset(1)
Next i
.AutoFilter
End With
Application.ScreenUpdating = True
End Sub
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Complex calculation from multiple sheets to master sheet | inreality01 | Excel | 49 | 01-06-2016 03:09 PM |
Excel, transfer data from Master Sheet to sub sheets, using key word from column
|
anvqui | Excel Programming | 9 | 06-16-2015 01:35 PM |
seprate process data from main master list
|
Santhosh AMASL | Excel | 1 | 01-12-2015 09:33 AM |
| Combine Data From 2 Sheets into a new sheet | bremen22 | Excel | 1 | 09-11-2013 12:59 PM |
How to syncronize data in two different sheets
|
diegogeid | Excel | 2 | 09-30-2010 12:19 AM |