Copy Data And Save In New Book?

Feb 5, 2014

I have a code in which we can split the data using column values into new and same sheet also. I want to modify this accordingly to my need but i am new in VBA so can't modify this. i want 2 changes in this macro:

1. I want to set a value (Like:"Resolved"," In Process" ) in the macro to extract the data related to the value only. Means, when i run this macro it will extract the data only for "Resolved" status. I have to create two macros for each defined status.

2. After splitting, it will ask me to save the new workbook location.

3. Save it.

The codes i m having are :

First code to make directories:

Code:
Public Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long

[code].....

View 4 Replies


ADVERTISEMENT

Copy Data From Book To Book Error

Jun 22, 2007

I have the below code, which now looks to see if a file is open or not, if it is, then copy and past 'Data' and if not open the book and copy 'Data'.

I think the code is sort of right, but im missing something, as i keep getting runtime error when i try and copy. Here is the
Sub PrintSaveKPIUpdate()

Dim sFilName As String
sFilName = "C: estCashSales_KPI.xls"
Set Main = ThisWorkbook

If IsOpen(sFilName) Then

' Book is Open.

Worksheets("Setup Data"). Range("Data").Activate

View 9 Replies View Related

Copy A Sheet Into A New Book And Save File Name As The Current Date

Jul 5, 2009

I have an excel file which I use when I book keep journals in work. Each time I come across a new piece of bookkeeping I add to the file, name the sheet and index it. (I've attached a loose example for illustration) so the bookkeeping template.xls gets bigger every day.

Currently, when I book keep on a particular day, I open the template.xls workbook;

draft my journals;

and then manually copy the worksheets I have completed during the day from the template.xls workbook and paste the sheets into a new book and save the days bookkeeping as the current date.

With the file I have attached can someone show me how to write a macro and apply it to each of the buttons on the various work sheet tabs (each button will run the same macro).

Upon clicking a button, I would like the macro to;

Copy the active sheet into a new book and save the file as the current date.

Each subsequent click of a button the macro will check if the .xls file exists for the current date, if it does, then it will just copy the active worksheet to the file that has already been created.

In the new file which is saved as the current date, I need to remove the macro button and the hyperlink that reads back to index.

I have had some helpful macro's provided from another forum, however, the other forum does not appear to enable users to upload files, so I can't quite convey what it is I am trying to achieve.

View 14 Replies View Related

Macro To Highlight Data Inside Other Data Or Move From Book To Book

Jul 16, 2014

so to start off im not able to attach things due to security reasons, what i need is either 1 of 2 macros. if its possible, both are related. one possible is as follows: i need it to go through a certain column (say I for example) and look at the information in it, this information can vary from peoples names along with dates and other stuff, i want it to look through these and if anything has a date today and prior i need the cell to be highlighted. problem is sometimes it might have 2 dates, or no dates. it should have todays date, their name, other information, and future date of something. but not everyone does, this is the macro i dont think that can exists.

2nd macro possibility the other macro uses the first sheet, AFTER been highlighted, normally by hand, and takes it to another workbook and puts in in certain spots. so the first sheet has names of everyone in column K. what i need is it to look at column I and if its highlighted take entire row to other book, and put into sheet under the person name in their tab. the second book has a tab for each person (at this time 18 tabs) which can fluxuate, and each tab is the persons first and last name, without spaces. since when i put sums on main page it didnt want to work with the spaces i had to omit them. again im not sure this is possible.

View 6 Replies View Related

Copy Data From One Book To Another From Common Data In One Cell

Feb 15, 2010

Got an issue that I can only seem to do with things like the program Hotkey and making physical macros. I'm sure it is easy but I'm lost.

I have data in one book that looks like this (Call it Book1)

Date: Service
ProviderReason for callCRM
SR #DM
SR #WO #Device #Serial #Issue15/02/2010DATE: 03/02/10
TIME: 11:29
BUS: 1234AO
ISSUE DETAILS: Issue with Console


and data in another book that looks like this (Call it Book2)

DeviceSerial NumberNameTerminal PositionTerminal Group Location DescriptionTerminal IDDescription Service Provider 104012343030123456ConsoleDriver Console1234AO90401234Service Provider Name found Here

I need to find the BUS: 1234AO from the cell in Book1 then look that Bus up in Book2 and then from Book2 copy the Device, Serial Number, and Service Provider into the cells into Book1 and repeat this infintely often. The problem I have is the the bus can have 1 Console and 1-5 Readers and I need to find that data also. So for example I need to find BUS 1234AO and get the Console details and past that into one issue and the next issue will have the same bus number 1234AO but I need the details for Reader2 (that detail is in the Name field as shown above.) The issue details will always have the Console text and Reader# text in it.

The problem I have is that the Reason for call cell has ALT-ENTER characters in it and the details are not always in the same spot but the details are almost always in the format ####AO (four numbers and the letters AO)

View 19 Replies View Related

Use ADO To Copy Data From Closed Book To Active Sheet

Mar 6, 2012

I have managed to use ADO to copy data from a closed book to my active sheet. Problem : it copies only the text, and not the dates or figures...

Code:

Sub TestReadDataFromWorkbook()
' fills data from a closed workbook in at the active cell.
GetDataFromClosedWorkbook "H:P&LYE TempDiv P&LP&L Report 020312.xls", "A1:Z1000", Range("A1"), False
End Sub

Code:

Sub GetDataFromClosedWorkbook(SourceFile As String, SourceRange As String, _
TargetRange As Range, IncludeFieldNames As Boolean)
'GetDataFromClosedWorkbook "C:FolderNameWorkbookName.xls", "A1:B21", ActiveCell, False
'GetDataFromClosedWorkbook "C:FolderNameWorkbookName.xls", "MyDataRange", Range("B3"), True

[Code]...

View 4 Replies View Related

Save Work Book In 2 Separate Directories

Apr 5, 2007

I have a fluid document that I have to save for historical reasons in 2 separate directories. My save Macro works I was just wondering if anyone see's a better way of accomplishing saving to two separate directories then closing the document. I used the record function to gernerate most of the code.

Sub SAVEANDEXITTHESLATE()
Dim date1
Dim date2
Dim xlCalc As XlCalculation
xlCalc = Application.Calculation
Application.Calculation = xlCalculationManual
On Error Goto CalcBack
Application.ScreenUpdating = False
date1 = Now()
date2 = Format(date1, "mmm d yyyy hh mm")
ActiveWorkbook.SAVE
Application.DisplayAlerts = False
ChDir "c:Documents and SettingsmeDesktop"
ActiveWorkbook.SaveAs Filename:= _...................

View 5 Replies View Related

Copy From One Book To Another Tab On Another Book

Aug 20, 2009

I would like to know if there is a way to copy a spreadsheet and paste it into a new tab on another spreadsheet. We currently download 2 lots of spreadsheets from SAP and would like to create another spreadsheet to act as a 'central' preadsheet. What I would like to happen is that the data from the 2 downloaded spreadsheets will be automatically pasted into 2 new tabs on the central spreadsheet, then run some formatting macros (which I can do fine).

View 3 Replies View Related

Copy From One Book To Another

Sep 30, 2009

I Have been working on a spreadsheet for attendance recording. I will be keeping a new one for each month. I need to be able to take accumulated data from one book and put it in the new one. I have the Following

View 2 Replies View Related

Copy A Sheet Into The Same Book

Aug 5, 2009

This is the error i get by doing> edit> move or copy sheet

A formula or sheet you want to move or copy contains the name 'HTML', which already exists on the detination worksheet. Do you want to use this version of the name?

I want to do is copy a sheet into the same book. If I click yes, two more errors pop up.

View 7 Replies View Related

Copy Data From A List Then Paste Into Another Workbook And Save As One Of Data Copied

Jun 15, 2014

I am trying to create a macro to copy a set of datas in a row , paste into another workbook (specific sheet),then save it as one of the datas that was copied over.

Workbook1

Ticket#
Description
Name

12345
Test 1
David

32145
Test 2
Steve

Workbook2 - sheet (ABC)

Copy row 2 from Workbook1, paste to row 1 in Workbook2 sheet(ABC)12345
Test 1
David

Saveas Workbook2 - ABC - "12345" - Ticket #

Copy row 3 from Workbook1, paste to row 1 in Workbook2 sheet(ABC)

And so on. I will have a set of data to trasfer to Workbook2, each row different workbook.

View 4 Replies View Related

How To Copy A Range To Another Work Book

Oct 1, 2008

I am trying to copy a range from one workbook to another book sheet with the below code. But its giving error.Can any body fix the below code.

Dim rng1, rng2 As Range
Set rng1 = ThisWorkbook.Sheets(1).Range("A1")

'Create a new work book
Dim xlapp As Object 'Excel.Application
Set xlapp = CreateObject("Excel.Application")
xlapp.Visible = True

' Add a new workbook
Dim xlbook As Object 'Excel.Workbook
Set xlbook = xlapp.Workbooks.Add......................

View 9 Replies View Related

Macro...Copy Columns From One Book To Another

Dec 22, 2009

I need a macro that will copy specific columns from one book into another workbook.

I imagine this isn't too hard, but i can't seem to find the answer.

Also, i have another macro at the moment which allows me, when i run it, to select the workbook which i wish to copy the columns from.

View 9 Replies View Related

Move All Worksheets From Book B Behind All Sheets In Book A?

Jul 18, 2014

I made the following code to merge 2 workbooks together.

The code is to be executed when the user has Workbook A opened. (All sheets in workbook KPISWD are supposed to be moved after all worksheets in workbook KPICustomers).

I keep getting a debug error on the code that is supposed to do the actual move and loop until it is finished with all of the sheets in Workbook B.

Code:
Dim KPICustomers, KPISWD As String
KPICustomers = ActiveWorkbook.Name

Workbooks.Open Filename:= _
"W:FacturatieKPI per periode SWD.xls"

KPISWD = ActiveWorkbook.Name

[Code] ..........

View 3 Replies View Related

Using VBA To Select Data / Copy Into Template And Save As

Jan 20, 2012

picking things up. At the moment I am trying to create a macro using VBA to do the following in this exact order:

1. Delete Column A and B (once only)
2. Automatically pick up credit card number (In column A)
3. Copy all instances of this credit card number (and all data on same row)
4. Open a template I have set up
5. Paste the copied data onto a specific sheet on this template
6. Save as file name "xxxx - branch name - XXXX - DDMMMYY"
7. Repeat (loop?) this for all credit card numbers on the sheet.

There are approximately 90 credit cards, and I need a new workbook for each one to work on separately.

View 7 Replies View Related

Copy Rows From One Book To Multiple Books And Sheets

Nov 16, 2009

I'm trying to copy rows from one workbook that is exported from access to multiple worksheets in multiple workbooks. I used a macro I found here from JBeaucaire that will copy the data for me but it over writes the information I have in rows 1-3 and also the rows below, 28-35.

Is there a way to copy the data without loosing the information in the first three rows and the rows below where the data goes?

View 6 Replies View Related

Automatically Save Copy As Text File When Data Changes

Sep 5, 2006

I'm trying to create a sub that will save my worksheet to a tab delimited text file anytime there is a change in the worsheet data (all cells are linked to cells in other workbooks). I've figured out the command to save the file

ActiveWorkbook.SaveAs Filename:= _
"C:Documents and SettingsChrisMy DocumentsBook1.txt", FileFormat:=xlText _
, CreateBackup:=False

but I'm not sure how to get a sub routine to start running when the file opens and to have it run continuously while open. I've found the command:

Application.Volatile

that will flag when any cells in my range are recomputed and run a function, but functions don't allow me to save the file.

View 4 Replies View Related

Copy Multiple Rows From One Book To Another Based On Info In Cell D

Aug 19, 2009

I have a workbook with a single worksheet that has about 2000 rows, columns A, B, C, D, E & F
Cells in colums A, B, C, E & F all have very different information in them, nothing is similar in any of those columns that I can base a criteria on. Cells in column D however will have 1 of about 18 possibilities in them

What I want to do is have another workbook with 18 worksheets, each worksheet named 1 of the 18 possibilities, and somehow magically pull the data from the first workbook and insert it into the correct worksheet in the second workbook, leaving the data in the first workbook intact.

I update the first workbook several times a day, adding and deleting from it so would need to update as it goes, or be able to run the update as and when needed.

My skills are limited to simple formulas inserted into cells and dragging them down!

View 11 Replies View Related

Copy Text Between Worksheets In Same Workbook To Consolidated Sheet In Same Book?

Feb 24, 2014

I have one sheet for each day of the month with a table that has Employee Name, Reason, and Expected Return. I need to copy each line into the monthly sheet, but each day may have varying number of rows. Needless to say I would like to do this without copying lots of blank lines into my consolidated sheet.

View 10 Replies View Related

Call Macro In Book Two From Book One

Aug 29, 2007

i have done a search on this topic and found many similar answers to many similar questions. All specify using Application.Run "workbookname.xls!macroname".

In my code, the filename has an assigned value as the master code goes out to many secondary files - the user selects the particular one they want at the start of the macro. The variable assigned is called "UpdateKAMsFile".

how do i get the macro called KAMsRandomColour to run in the workbook designated by UpdateKAMsFile?

View 9 Replies View Related

Save Back Up Copy Online At Each Save

Mar 27, 2008

I have a sheet which I would like to back up online every time it is saved.

I have a sub, OnlineFile(), which I have used many times without any problems, which creates a .BAT file to use ftp to upload files onto our server. As arguments, it takes the local file path that you want to upload (or download to), the name of the file as you would like it stored, the online file path, and whether you want to upload the file onto the server, or download it off the server.

It should be very easy to combine the two: what I tried was:


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, cancel As Boolean)
ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "" & "Rubbish.xls"
Call OnlineFile(ThisWorkbook.Path & "" & "Rubbish.xls", "Rubbish.xls", "wwwrootexcelfilesMasters", "Upload")
Kill ThisWorkbook.Path & "" & "Rubbish.xls"
End Sub

Every time I ran this, the file got uploaded correctly, but Excel had a series of problems. Often the code ran fine the first time it was run, but crashed the second time round.

After a fair bit of troubleshooting, I found that the problem came about when the file was trying to save itself - i.e. after the end of the sub. If you pause any macros from running, it still saved fine, but when the code ran, it found errors, froze or closed excel.

My thought at this point was that the code was fragmented or something. I made a new sheet, and retyped just the relevant bits of code (i.e. the BeforeSave sub, the OnlineFile sub and created the form called by OnlineFile). The problem persisted.

I've come up with a workaround for this now (which uses the same OnlineFile sub & form, and works fine), but it's driving me crazy - why does this cause excel to die? Particularly on the second time through? The code seems far too simple to cause such problems - is there a bug in Excel perhaps (I'm using Excel 2000 on Windows XP).

View 9 Replies View Related

Listing Data Forms Into Another Book

Nov 7, 2008

I'm using Excel 2003

I have done this once already, so I know its possible but I cannot remember what it is called and how to do it.

I have a "form", I open it up, fill out a few different things, and then save and print it. When I save it I want it to take a few different cells information and report it into a seperate workbook, without having to open the report workbook. I use this seperate workbook to reference when I fill out the form and who it was sent to.

I remember there was a wizard that I used to get it to do all this, but I can't for the life of me remeber what it was.

View 10 Replies View Related

VBA - Copying Data To Another Book Using Match

Apr 22, 2014

I need to transfer data from one sheet to another sheet in another workbook. The output row corresponds to a value in input column a, and output column corresponds to a date in input sheet column B.

I've previously dim-ed the input/out workbooks/sheets as wbin, wbout, sheetin, sheetout respectively. The error I get is runtime error '9': subscript out of range in the copy destination line.

Code:
Windows(wbin).Activate
Sheets(sheetin).Select

iMaxRow = 5000
Dim subj1 As String
Dim subj2 As String
For iRow = 1 To iMaxRow

[Code] .........

For now, i've disabled the on error resume next. Also, the input column a has 4 numbers followed by string, while the corresponding output row header only has the 4 numbers, hence I tried matching with the wildcard.

View 9 Replies View Related

Data Lookup From Offline Book With A Formula

Feb 24, 2010

where do i put the indirect.ext to below formula so that that Test.exe file be checked offline .. this below works only if the test.exe is open.

=IF(A2="";"";COUNTIF('C:Folder[Test 24.02.10.xls]Table1'!A$1:A$65536;A2))

Since the Test file is generated every day..

how can i make the Test file shown every day with different date.. this 24.02.10 is not permanent.. everyday changes.. meaning tomorrow it checks Test 25.02.10.exe, Friday it checks 26.02.10 etc.

I could make a cell for date input .. and from that cell it could be added up to enter into above formula automatically..

View 9 Replies View Related

Importing Outlook Address Book Data

Feb 20, 2007

I've had a scan through the archives trying to find a post or item on importing Outlook data to Excel, and have so far only found articles on importing data from users' 'Contacts' lists. I need functionality so that when the user selects an office (e.g. 'London') from a list, further details for those offices - which are stored as individual members of the global Outlook addressbook - for example postcode, can be operated upon.

Because this data is relatively dynamic (e.g. potential for relocation of office premises), I need any procedures to refer to a single unified data source, therefore I'd like any VBA procedures to use data directly from the outlook address book, instead of importing a static copy of the data and then performing operations on this.

View 3 Replies View Related

Capturing Data: Capture Fleet No & Model From Book 1

Oct 22, 2009

find the attached file. Book 2 there is 4 columns ie,reg no,fleet no,product & model and on book 1 there is fleet no,reg no and model and what i need is to capture fleet no & model from Book 1.

View 2 Replies View Related

Can Data Validation Lists Reference Another Work Book?

Aug 17, 2009

I have a cell that I want to use data validation on so I have a drop down list. Problem is the location of this list will be in another workbook.. Is this possible to go from one workbook to another using data validation?

Also, depending on the information that is selected from the drop down list I want a cell to the left to pick the corresponding data from the list in the other workbook. These forms will always be in the same folder.. Not sure if that information is necessary but just in case you need to know.

View 4 Replies View Related

VBA Data Entry Form - Populating Separate Book

Sep 30, 2009

I have built a data entry form (Input tab) and have code populating a table (Table tab). Currently both are in the same book, but I would like to house them in separately.

What is the proper VBA syntax for this? Will both books need to be open in order to populate the table?

The 'real' data is hosted on sharepoint and is getting darn big. The result is problems opening the doc and looong save times. My thought was to have the secretaries doing data entry open a single sheet (Input Form) which will then populate the data in another sheet. I'm dreaming, aren't I...

I know Access would solve everything, but for cost reasons I am stuck with Excel.

View 10 Replies View Related

Xfer Data B/w Books W/ One Book Having Differ File Name

Apr 8, 2008

I'm transferring data from one workbook to another. The first workbook ('Request Form') will always have a different file name depending on which user is saving it. However, the worksheet within that book will always have the same name ('Tab A'). Workbook and worksheet 2 ('PTS' and '2008' respectively) will remain the same.

Basically I want the macro to open 'Request Form' (whatever the name, wherever it's saved) and stay open as the rest of the macro runs. I need that file name to be a sort of wildcard, since the file path and file name will never be the same. How can I do this?

Dim TabA As Worksheets
Application.GetOpenFilename
Application.ScreenUpdating = False
Set wbOpen = Workbooks.Open("Request Form.xls") --THIS NEEDS TO BE A WILDCARD
'Declares the ClientName
Sheets("TabA").Select

View 9 Replies View Related

Macro To Copy Sheet From Closed Work Book And Overwrite If Sheet Already Exists

Nov 22, 2009

I am currently using a macro to copy a sheet from a closed workbook in to my current workbook. However this copying is based on the sheet name. At present when I run the following code

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved