Pulling Data From One Excel To Another
How can I pull data from a master list and parse by the different values in one column into separate sheets. The parse information will automatically be in the format of the sheet it is going to. Look at the examples below. Example 1 is the Mast List. Example 2 is the template. I am trying to pull only the information needed to auto fill example 2 from example 1 but parse it into different sheets within the workbook by the supplier name.
Example 1
microsoft-excel
New contributor
add a comment |
How can I pull data from a master list and parse by the different values in one column into separate sheets. The parse information will automatically be in the format of the sheet it is going to. Look at the examples below. Example 1 is the Mast List. Example 2 is the template. I am trying to pull only the information needed to auto fill example 2 from example 1 but parse it into different sheets within the workbook by the supplier name.
Example 1
microsoft-excel
New contributor
add a comment |
How can I pull data from a master list and parse by the different values in one column into separate sheets. The parse information will automatically be in the format of the sheet it is going to. Look at the examples below. Example 1 is the Mast List. Example 2 is the template. I am trying to pull only the information needed to auto fill example 2 from example 1 but parse it into different sheets within the workbook by the supplier name.
Example 1
microsoft-excel
New contributor
How can I pull data from a master list and parse by the different values in one column into separate sheets. The parse information will automatically be in the format of the sheet it is going to. Look at the examples below. Example 1 is the Mast List. Example 2 is the template. I am trying to pull only the information needed to auto fill example 2 from example 1 but parse it into different sheets within the workbook by the supplier name.
Example 1
microsoft-excel
microsoft-excel
New contributor
New contributor
edited 2 days ago
Scott Craner
11.2k1815
11.2k1815
New contributor
asked 2 days ago
user981052
1
1
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
We can't see your example2 and example1 isn't much to go on, so here is an outline of untested and unfinished code that should get you started. Pay attention to the comments and complete as needed.
Sub Template_per_Supplier()
Dim supplierDict As Object
Dim numRows As Long
Dim rowPos As Long
Dim dataStart As Long
Dim suppName As String
Dim suppCol As String
'column with Supplier Names:
suppCol = "H"
'first row with data:
rowPos = 4
Dim currSheet As Worksheet
Set currSheet = ActiveSheet
Set supplierDict = CreateObject("Scripting.Dictionary")
numRows = currSheet.Range(suppCol + "1").CurrentRegion.Rows.Count
dataStart = rowPos
Do While rowPos <= numRows
suppName = currSheet.Cells(rowPos, 1).Value2
If supplierDict.exists(suppName) Then
Else
supplierDict.Add suppName, 0
End If
rowPos = rowPos + 1
Loop
Dim suppSheet As Worksheet
Dim i As Long
Dim newPos As Long
Dim Column As Long
Column = 0
For Each myKey In supplierDict
' instead of adding in this next step you may want to copy your template sheet:
Set suppSheet = ThisWorkbook.Worksheets.Add
suppSheet.Name = myKey
' do your static transfers here: Name, phone, etc..:
' Example:
' suppSheet.Cells(1, 1).Value2 = currSheet.Cells(1, 1).Value2
' set this newPos variable to be the first data line row in your template
newPos = 2
rowPos = dataStart
Column = Column + 1
suppSheet.Cells(1, Column).Value2 = myKey
Do While rowPos <= numRows
If currSheet.Cells(rowPos, 1).Value2 = myKey Then
' map all your data transfers here:
' Examples: New_data_Column and Original_Data_Column should be set per data item
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
newPos = newPos + 1
End If
rowPos = rowPos + 1
Loop
Next
End Sub
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
user981052 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390652%2fpulling-data-from-one-excel-to-another%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
We can't see your example2 and example1 isn't much to go on, so here is an outline of untested and unfinished code that should get you started. Pay attention to the comments and complete as needed.
Sub Template_per_Supplier()
Dim supplierDict As Object
Dim numRows As Long
Dim rowPos As Long
Dim dataStart As Long
Dim suppName As String
Dim suppCol As String
'column with Supplier Names:
suppCol = "H"
'first row with data:
rowPos = 4
Dim currSheet As Worksheet
Set currSheet = ActiveSheet
Set supplierDict = CreateObject("Scripting.Dictionary")
numRows = currSheet.Range(suppCol + "1").CurrentRegion.Rows.Count
dataStart = rowPos
Do While rowPos <= numRows
suppName = currSheet.Cells(rowPos, 1).Value2
If supplierDict.exists(suppName) Then
Else
supplierDict.Add suppName, 0
End If
rowPos = rowPos + 1
Loop
Dim suppSheet As Worksheet
Dim i As Long
Dim newPos As Long
Dim Column As Long
Column = 0
For Each myKey In supplierDict
' instead of adding in this next step you may want to copy your template sheet:
Set suppSheet = ThisWorkbook.Worksheets.Add
suppSheet.Name = myKey
' do your static transfers here: Name, phone, etc..:
' Example:
' suppSheet.Cells(1, 1).Value2 = currSheet.Cells(1, 1).Value2
' set this newPos variable to be the first data line row in your template
newPos = 2
rowPos = dataStart
Column = Column + 1
suppSheet.Cells(1, Column).Value2 = myKey
Do While rowPos <= numRows
If currSheet.Cells(rowPos, 1).Value2 = myKey Then
' map all your data transfers here:
' Examples: New_data_Column and Original_Data_Column should be set per data item
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
newPos = newPos + 1
End If
rowPos = rowPos + 1
Loop
Next
End Sub
add a comment |
We can't see your example2 and example1 isn't much to go on, so here is an outline of untested and unfinished code that should get you started. Pay attention to the comments and complete as needed.
Sub Template_per_Supplier()
Dim supplierDict As Object
Dim numRows As Long
Dim rowPos As Long
Dim dataStart As Long
Dim suppName As String
Dim suppCol As String
'column with Supplier Names:
suppCol = "H"
'first row with data:
rowPos = 4
Dim currSheet As Worksheet
Set currSheet = ActiveSheet
Set supplierDict = CreateObject("Scripting.Dictionary")
numRows = currSheet.Range(suppCol + "1").CurrentRegion.Rows.Count
dataStart = rowPos
Do While rowPos <= numRows
suppName = currSheet.Cells(rowPos, 1).Value2
If supplierDict.exists(suppName) Then
Else
supplierDict.Add suppName, 0
End If
rowPos = rowPos + 1
Loop
Dim suppSheet As Worksheet
Dim i As Long
Dim newPos As Long
Dim Column As Long
Column = 0
For Each myKey In supplierDict
' instead of adding in this next step you may want to copy your template sheet:
Set suppSheet = ThisWorkbook.Worksheets.Add
suppSheet.Name = myKey
' do your static transfers here: Name, phone, etc..:
' Example:
' suppSheet.Cells(1, 1).Value2 = currSheet.Cells(1, 1).Value2
' set this newPos variable to be the first data line row in your template
newPos = 2
rowPos = dataStart
Column = Column + 1
suppSheet.Cells(1, Column).Value2 = myKey
Do While rowPos <= numRows
If currSheet.Cells(rowPos, 1).Value2 = myKey Then
' map all your data transfers here:
' Examples: New_data_Column and Original_Data_Column should be set per data item
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
newPos = newPos + 1
End If
rowPos = rowPos + 1
Loop
Next
End Sub
add a comment |
We can't see your example2 and example1 isn't much to go on, so here is an outline of untested and unfinished code that should get you started. Pay attention to the comments and complete as needed.
Sub Template_per_Supplier()
Dim supplierDict As Object
Dim numRows As Long
Dim rowPos As Long
Dim dataStart As Long
Dim suppName As String
Dim suppCol As String
'column with Supplier Names:
suppCol = "H"
'first row with data:
rowPos = 4
Dim currSheet As Worksheet
Set currSheet = ActiveSheet
Set supplierDict = CreateObject("Scripting.Dictionary")
numRows = currSheet.Range(suppCol + "1").CurrentRegion.Rows.Count
dataStart = rowPos
Do While rowPos <= numRows
suppName = currSheet.Cells(rowPos, 1).Value2
If supplierDict.exists(suppName) Then
Else
supplierDict.Add suppName, 0
End If
rowPos = rowPos + 1
Loop
Dim suppSheet As Worksheet
Dim i As Long
Dim newPos As Long
Dim Column As Long
Column = 0
For Each myKey In supplierDict
' instead of adding in this next step you may want to copy your template sheet:
Set suppSheet = ThisWorkbook.Worksheets.Add
suppSheet.Name = myKey
' do your static transfers here: Name, phone, etc..:
' Example:
' suppSheet.Cells(1, 1).Value2 = currSheet.Cells(1, 1).Value2
' set this newPos variable to be the first data line row in your template
newPos = 2
rowPos = dataStart
Column = Column + 1
suppSheet.Cells(1, Column).Value2 = myKey
Do While rowPos <= numRows
If currSheet.Cells(rowPos, 1).Value2 = myKey Then
' map all your data transfers here:
' Examples: New_data_Column and Original_Data_Column should be set per data item
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
newPos = newPos + 1
End If
rowPos = rowPos + 1
Loop
Next
End Sub
We can't see your example2 and example1 isn't much to go on, so here is an outline of untested and unfinished code that should get you started. Pay attention to the comments and complete as needed.
Sub Template_per_Supplier()
Dim supplierDict As Object
Dim numRows As Long
Dim rowPos As Long
Dim dataStart As Long
Dim suppName As String
Dim suppCol As String
'column with Supplier Names:
suppCol = "H"
'first row with data:
rowPos = 4
Dim currSheet As Worksheet
Set currSheet = ActiveSheet
Set supplierDict = CreateObject("Scripting.Dictionary")
numRows = currSheet.Range(suppCol + "1").CurrentRegion.Rows.Count
dataStart = rowPos
Do While rowPos <= numRows
suppName = currSheet.Cells(rowPos, 1).Value2
If supplierDict.exists(suppName) Then
Else
supplierDict.Add suppName, 0
End If
rowPos = rowPos + 1
Loop
Dim suppSheet As Worksheet
Dim i As Long
Dim newPos As Long
Dim Column As Long
Column = 0
For Each myKey In supplierDict
' instead of adding in this next step you may want to copy your template sheet:
Set suppSheet = ThisWorkbook.Worksheets.Add
suppSheet.Name = myKey
' do your static transfers here: Name, phone, etc..:
' Example:
' suppSheet.Cells(1, 1).Value2 = currSheet.Cells(1, 1).Value2
' set this newPos variable to be the first data line row in your template
newPos = 2
rowPos = dataStart
Column = Column + 1
suppSheet.Cells(1, Column).Value2 = myKey
Do While rowPos <= numRows
If currSheet.Cells(rowPos, 1).Value2 = myKey Then
' map all your data transfers here:
' Examples: New_data_Column and Original_Data_Column should be set per data item
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
' suppSheet.Cells(newPos, New_data_Column).Value2 = currSheet.Cells(rowPos, Original_Data_Column).Value2
newPos = newPos + 1
End If
rowPos = rowPos + 1
Loop
Next
End Sub
answered 2 days ago
Brian
643
643
add a comment |
add a comment |
user981052 is a new contributor. Be nice, and check out our Code of Conduct.
user981052 is a new contributor. Be nice, and check out our Code of Conduct.
user981052 is a new contributor. Be nice, and check out our Code of Conduct.
user981052 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390652%2fpulling-data-from-one-excel-to-another%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown