Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #31  
Old 04-06-2015, 11:30 AM
charlesdh charlesdh is offline Creating multiple spreadsheets based on text Windows 7 32bit Creating multiple spreadsheets based on text Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,



I modified this part of the code.
Code:
On Error Resume Next
                Workbooks.Open Filename:=MyPath & "\" & Item & ".xlsx", UpdateLinks:=0
                If Err = "1004" Then '' this will be chaned when you determine if you want to create a new vendor workbook
                    MsgBox " Hi! At this point you need to create a new file for this Vendor will now exit sub"
                Exit Sub
                End If
Reply With Quote
  #32  
Old 04-06-2015, 11:34 AM
ksigcajun ksigcajun is offline Creating multiple spreadsheets based on text Windows 7 64bit Creating multiple spreadsheets based on text Office 2010 64bit
Advanced Beginner
Creating multiple spreadsheets based on text
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by charlesdh View Post
Hi,

My error. Should have tested further.
Check this copy. It should copy data to the workbook and close it. Then it should open next workbook. If the next Vendor does not exist you will get the Msgbox.
It filters, copies the data correctly, the message box is displayed and that is it.

I believe the message box is displayed because it filters on the one vendor and cant find the next Vendor?
Reply With Quote
  #33  
Old 04-06-2015, 11:36 AM
ksigcajun ksigcajun is offline Creating multiple spreadsheets based on text Windows 7 64bit Creating multiple spreadsheets based on text Office 2010 64bit
Advanced Beginner
Creating multiple spreadsheets based on text
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by charlesdh View Post
Hi,

I modified this part of the code.
Code:
On Error Resume Next
                Workbooks.Open Filename:=MyPath & "\" & Item & ".xlsx", UpdateLinks:=0
                If Err = "1004" Then '' this will be chaned when you determine if you want to create a new vendor workbook
                    MsgBox " Hi! At this point you need to create a new file for this Vendor will now exit sub"
                Exit Sub
                End If
Didnt change anything, that I saw. Still filters, copies, message box is displayed and thats it.
Reply With Quote
  #34  
Old 04-07-2015, 12:04 PM
charlesdh charlesdh is offline Creating multiple spreadsheets based on text Windows 7 32bit Creating multiple spreadsheets based on text Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

I now have this file open vendors file and populate it. It will or should create a new vendor file and populate it. The code will also remove data in sheet2.
The repopulate it.
I created a "Template for the new Vendors".
You need to correct the path for the new vendor workbook. I made remarks in the code module for this.
Be sure you put all file in the same path!
Attached Files
File Type: xlsm Test Data1.xlsm (23.6 KB, 9 views)
File Type: xltx Vendor Template.xltx (161.3 KB, 8 views)
Reply With Quote
  #35  
Old 04-08-2015, 09:36 AM
ksigcajun ksigcajun is offline Creating multiple spreadsheets based on text Windows 7 64bit Creating multiple spreadsheets based on text Office 2010 64bit
Advanced Beginner
Creating multiple spreadsheets based on text
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by charlesdh View Post
Hi,

I now have this file open vendors file and populate it. It will or should create a new vendor file and populate it. The code will also remove data in sheet2.
The repopulate it.
I created a "Template for the new Vendors".
You need to correct the path for the new vendor workbook. I made remarks in the code module for this.
Be sure you put all file in the same path!
Thank you sir! I'll be testing this out later today.
Reply With Quote
  #36  
Old 04-08-2015, 10:48 AM
charlesdh charlesdh is offline Creating multiple spreadsheets based on text Windows 7 32bit Creating multiple spreadsheets based on text Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

OK, thanks for the update.
Reply With Quote
  #37  
Old 04-09-2015, 11:42 AM
ksigcajun ksigcajun is offline Creating multiple spreadsheets based on text Windows 7 64bit Creating multiple spreadsheets based on text Office 2010 64bit
Advanced Beginner
Creating multiple spreadsheets based on text
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by charlesdh View Post
OK, thanks for the update.
Couple of things...

After the first workbook is created and copied, the macro doesnt populate anymore workbooks after that. It creates, saves but everything is blank.

Also, I understand it wont work for Vendors only with one line, but it didnt create a workbook for the last vendor.

Any suggestions?
Reply With Quote
  #38  
Old 04-09-2015, 12:08 PM
charlesdh charlesdh is offline Creating multiple spreadsheets based on text Windows 7 32bit Creating multiple spreadsheets based on text Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

OK,

I'll check to see what happens.
Reply With Quote
  #39  
Old 04-09-2015, 12:31 PM
charlesdh charlesdh is offline Creating multiple spreadsheets based on text Windows 7 32bit Creating multiple spreadsheets based on text Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

Lets try this one. I tested all file and it appears to work. Had to add a boolean for the new workbook.
Attached Files
File Type: xlsm Test Data1.xlsm (23.7 KB, 7 views)
Reply With Quote
  #40  
Old 04-09-2015, 01:30 PM
ksigcajun ksigcajun is offline Creating multiple spreadsheets based on text Windows 7 64bit Creating multiple spreadsheets based on text Office 2010 64bit
Advanced Beginner
Creating multiple spreadsheets based on text
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by charlesdh View Post
Hi,

Lets try this one. I tested all file and it appears to work. Had to add a boolean for the new workbook.
That works really well. Thank you!!! What a huge timesaver.
Reply With Quote
  #41  
Old 04-09-2015, 03:59 PM
charlesdh charlesdh is offline Creating multiple spreadsheets based on text Windows 7 32bit Creating multiple spreadsheets based on text Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

There is 1 thing about this code it will over write sheet1. If this is a problem you can use this line of code.

Code:
if Fpass = False And ActiveWorkbook.Sheets("Sheet1").Range("D8").Text = " " Then '' added the "and" statement
                        ActiveWorkbook.Sheets("Sheet1").Range("D8").Value = ws.Cells(Dcell.Row, 1).Text
                        ActiveWorkbook.Sheets("Sheet1").Range("D12").Value = ws.Cells(Dcell.Row, 2).Text
                        Fpass = True
                    End If
Reply With Quote
  #42  
Old 04-13-2015, 10:05 AM
ksigcajun ksigcajun is offline Creating multiple spreadsheets based on text Windows 7 64bit Creating multiple spreadsheets based on text Office 2010 64bit
Advanced Beginner
Creating multiple spreadsheets based on text
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by charlesdh View Post
There is 1 thing about this code it will over write sheet1. If this is a problem you can use this line of code.

Code:
if Fpass = False And ActiveWorkbook.Sheets("Sheet1").Range("D8").Text = " " Then '' added the "and" statement
                        ActiveWorkbook.Sheets("Sheet1").Range("D8").Value = ws.Cells(Dcell.Row, 1).Text
                        ActiveWorkbook.Sheets("Sheet1").Range("D12").Value = ws.Cells(Dcell.Row, 2).Text
                        Fpass = True
                    End If
When does it overwrite Sheet1? I havent experienced that when running the code.
Reply With Quote
  #43  
Old 04-13-2015, 10:14 AM
charlesdh charlesdh is offline Creating multiple spreadsheets based on text Windows 7 32bit Creating multiple spreadsheets based on text Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

Prior to this modification each time you open the vendors workbook the code will over write sheet1. The reason is we have the Fpass set to false when you open it.
To over come this I add a bit of code to looks at sheet1 to see if it is already populated. If it is the the code will not over write the existing data.
Reply With Quote
  #44  
Old 04-13-2015, 10:30 AM
ksigcajun ksigcajun is offline Creating multiple spreadsheets based on text Windows 7 64bit Creating multiple spreadsheets based on text Office 2010 64bit
Advanced Beginner
Creating multiple spreadsheets based on text
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by charlesdh View Post
Hi,

Prior to this modification each time you open the vendors workbook the code will over write sheet1. The reason is we have the Fpass set to false when you open it.
To over come this I add a bit of code to looks at sheet1 to see if it is already populated. If it is the the code will not over write the existing data.
Understood and thank you. Ill add the code and see if it runs successfully for me.
Reply With Quote
  #45  
Old 04-13-2015, 11:52 AM
ksigcajun ksigcajun is offline Creating multiple spreadsheets based on text Windows 7 64bit Creating multiple spreadsheets based on text Office 2010 64bit
Advanced Beginner
Creating multiple spreadsheets based on text
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quick question, Im thinking of using this macro in a Userform. If I added the years (2015, 2016, 2017 and 2018) to Column F of Sheet1 would it be easy for the macro to see the year in ComboBox1 and run it for that specific year?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating multiple spreadsheets based on text Creating a table that automatically updates based on entries of a heading in the document cahphoenix Word 3 10-29-2014 01:11 PM
Creating multiple spreadsheets based on text I need to add multiple values based on multiple criteria in a cell not sure what to do AUHAMM Excel 3 10-27-2014 09:11 PM
Creating multiple spreadsheets based on text Need help creating a Word document that is populated based on certain selected values alidaanish Word 1 01-10-2014 10:44 PM
Creating multiple spreadsheets based on text Creating Report based on 'Task Summary' and 'Sub Tasks' alijahed Project 1 02-01-2013 04:20 AM
Creating multiple spreadsheets based on text Creating formula based on if data is correct in cell MattMurdock Excel 1 08-06-2012 03:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft