Moving Back And Forth Between Files

May 12, 2007

I am developing a macro where I need to open a file, copy a value from a cell in that file and paste it in a cell of the original file. I need to do this several times from the same two files. My problem is that I don't have a command that moves back to the newly opened file to copy another value and paste it, again, in a cell of the original file. I can't use a specific file name to move to the newly opened file because the new file name changes every day. Here is the command that I use to open a new file:

Dim fn As Variant
fn = Application. GetOpenFilename("Excel-files,*.xls", _
1, "Select The Previous Day's Borrowing File To Open", , False)
If TypeName(fn) = "Boolean" Then Exit Sub
' the user didn't select a file
Debug.Print "Selected file: " & fn
Workbooks.Open fn

I need to move back to file fn several times, but, as I stated above, the file fn changes every day.

View 7 Replies


ADVERTISEMENT

Moving And Deleting Entire Rows Between Tabs In Workbook And Moving Them Back If Needed

Sep 23, 2013

I have an excel work book with 6 tabs. I would like to have Excel move an entire row from one tab to another tab (removing the row and inserting it in the other tab). I.e. Example I have a tab with items that are marked as "Open Actions" so if I were to change the drop down to close. Excel would move that entire row of actions to the tab with the "closed actions" and insert into the next available row. Now if someone were to come back at a later date say no it should be reopened than I would change the drop down to open and excel would move that row back to the open actions tab into next available row. I tried a PIVOT table and no good I played with few macro and not.

View 5 Replies View Related

Name Of Workbook When Moving Data Back And Forth

Jul 9, 2012

I am having some trouble writing a code for a macro that moves data between documents.

The document that I transfer data from is an excel extract from a survey, so everytime I have to run the macro, it is with a new document with a new name.

I can get so far as to move the first cell information into the other specified workbook, but I cannot get the macro to return to the the first document (the one where the name changes with every use).

View 1 Replies View Related

Radio Buttons Macros Hyperlinks And Moving Back?

Sep 6, 2002

I'd like to insert some radio buttons in a worksheet that activate a hyperlink to a web page and then be able to go back to where I started (ie the radio button)

I can link the button to a macro which was a recording of clicking on a hyperlink. The trouble is when I hit the return arrow to return to the sheet from the web page I go back to the location of the hyperlink not where I started from.

Is there a way to do this with the buttons.

If I can rearrange the sheet to allow for more narrow columns I may be able to just use the hyperlink friendly name argument and do it that way but I'm not so sure I can insert more narrow columns without messing up the layout of the whole sheet. With a button I can float several of them over an area regardless of the width of the columns.

View 1 Replies View Related

Moving All Files With Vba

Feb 13, 2007

I'm looking for a macro to move all files from one folder to another. I won't know what the files are called and don't really need to know. They could and will be different every time. The purpose is to clear out the files created in the past fortnight ready for the next batch job to run.

View 2 Replies View Related

Shortcuts For Moving Tabs To Different Files

Mar 5, 2013

Shortcuts for moving tabs to different files. A copy of the tab, I mean.

View 1 Replies View Related

Moving Files From Folder And Sub-folders

Jan 29, 2014

I need to move all the "Excel" files which are available in Folder and also the Subfolders from this location.

I need all the Excel files.

I found a code which is able to move only from Folder but not from the Subfolder.

HTML Code: 

Sub Move_Certain_Files_To_New_Folder()
'This example move all Excel files from FromPath to ToPath.
'Note: It will create the folder ToPath for you with a date-time stamp
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
Dim FileExt As String
Dim FNames As String

[code].....

View 3 Replies View Related

Calculating Distances Between Back-to-back Locations

Aug 11, 2012

I have a layout something like the following:

A1
A2
A3

[Code]....

Where each (i.e., A1) represents a location. I have tried to use a coordinate system but this will not work for the back-to-back locations. (Assuming each location is 2 feet wide, For example A1 to C1 is 4 feet apart, not 2 feet (as Euclidean or rectilinear would calculate it as).

Would there be a way to incorporate an if statement for those locations that are back-to-back? As a rectilinear distance calculation would work as long as the locations are not part of the same "block".

Ultimately I am looking to have a matrix which contains all the distances between each location:

A1
A2
A3
B1

[Code].....

View 4 Replies View Related

Copy The Current Price Back To Sheet1. The Current Price Needs To Be Pasted Back Into Sheet1 (next To The Existing Price)

Jul 24, 2006

All data is located within one book. I have two sheets with material codes in each sheet which include pricing (existing and current)

Sheet1 (has existing material codes plus existing pricing) Has about 1200 lines
Sheet2 (has current material codes plus current pricing), has about 36000 lines

I need to cross check if the material code (taken from sheet1) are still available in sheet2, and if they are, copy the current price back to sheet1. The current price needs to be pasted back into sheet1 (next to the existing price). If the material code doesn't exist (for whatever reason, in sheet2), the program needs to move onto the next line and leave the current price for that material code blank. The program should finish once all the lines in sheet1 are completed. I have attached a sample of what I'm trying to do,

View 7 Replies View Related

VBA - Carry Out Task On Set Of CSV Files - Return Values And Leave Files Untouched?

May 14, 2013

Trying to write a script to carry out a number of tasks but is there code to enable an Excel to look in a particular file for the list of csv files - carry out the tasks and return the appropriate values in the Excel sheet whilst leaving the original csv files untouched?

View 2 Replies View Related

Transfering Files From Lots Of Files To One Single Exel Master File.

Jun 26, 2009

Need a way to update a single master file. What happens right now is that the cost manager sends out one file to a lot of different project heads and then on having them return back to him he basically has to individually add in all the data. What i am trying to do is that he somehow carries on sending out the data as there are a lottt of projects and then on returning them they automatically update.

View 14 Replies View Related

Copy And Rename Files In VBA By Searching Multiple Folders For Files?

Jan 4, 2014

how I can loop through folders to select files starting with a certain word and copy all of them to a different folder and rename them. The folder structure is given below

Company 1(parent folder)
North South East(sub folder) West(sub folder)
Jan Feb Mar.... Dec Jan Feb Mar.... Dec Jan Feb Mar.... Dec Jan Feb Mar.... Dec

In the above structure, the files are present inside each folders Jan, feb...Dec under the regions North, South East n west. note that I have to select files starting with "Sales" and copy them into a new folder(say results) and rename copied files as Sales1.xls, Sales2.xls etc. (Files are not present in the folder company1, north, south, east and east.)

View 1 Replies View Related

Open Files In Folder- Wait 30 Seconds Then Close The Files

Jul 5, 2007

I want to allow users to place files (.jpg, .tif, .pdf, .pps etc) into a network folder and then have my program open each file and display it for 30 seconds then close the file and the application before opening the next file.

1. Set up a loop to get a directory listing of the folder and write the listing to a text file.

2. Open up the text file and get the next filename in it

3. Open the file in the associated application

4. Wait for 30 seconds (or some period of time) and then close the file

5. Repeat steps 2-4

DoIt = 1
While DoIt = 1
Open "C:TempList.txt" for output as #1
Print #1, Files In Folder
Close #1

Open "C:TempList.txt" for input as #2
while not eof(2)
Line input #2, MyFile
Display MyFile on screen
Wait for 30 seconds
Close MyFile and MyApplication that opened it
wend
Close #2

I can get the directory listing just fine with no problems

I can open the files in the associated application just fine with no problems.

with closing the application after 30 seconds or some period of time.

I need some code that will allow me to easily send it a filename and it will know how to close the file and the application that opened it.

View 9 Replies View Related

Files Saved To Program Files Folder, Open As Read Only

Feb 8, 2009

I have an Excel application (Excel 2003) which is stored in the default Program Files folder by the Installer; for example: c:program fileszxchello.xls. The problem I am running into is this file opens as Read Only in Vista and this is interfering with the running of the application. There is no problem opening the file normally in Windows XP.

I have been able to narrow down the cause of this to the User Account Control system in Vista - if I turn OFF User Account Control, the Excel file opens normally and my application functions normally. Is there another option to open the Excel file without turning OFF User Account Control because some users may find it unacceptable to turn OFF this security feature. Ofcourse, one option is to install the application in another location, outside the Program Folder, and the file would open normally, but the Packaging Wizard that I am using to package the application does not allow me to install the application in any other location and thus, the application installs in the Program Folder and I am running into this problem of the Exel file opening as Read Only. Is there a way out of this situation where I can open the file normally (not as Read Only)?

View 5 Replies View Related

Add Another Worksheet & Continue Importing The Html Files Until There Are No More Files To Import

Jul 13, 2006

I'm using the following code to import thousands of html files into my spreadsheet. The code is working fine. Since I am importing thousands of files, when there is no more space on my worksheet, the code stops with an error message. I want to make this code add another worksheet & continue importing the html files until there are no more files to import.

Sub Master_Importer()
Dim I As Long
Dim strFilename As String
Dim strPath As String
strPath = "file:///C:/Documents and Settings/c/Desktop/New Folder/"
With Application.FileSearch
.LookIn = "C:Documents and SettingscDesktopNew Folder"
.FileType = msoFileTypeAllFiles
.Execute
For I = 1 To .FoundFiles.Count
strFilename = Mid(.FoundFiles(I), InStrRev(.FoundFiles(I), "") + 1)
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & strPath & strFilename _ .......................

View 5 Replies View Related

Save Ranges In Multiple Files To Text Files

Dec 21, 2007

I have a excel file that I enter information into. I have code that saves the files to a certain folder with the name, date, and time stamp for the file name. At the end of the day I might have 3 to 15 excel files I have created that day and I would like to take information from certain cells (examle: L3, B6, B7, B8, G8, and so on) and create a txt file with all of the information in it.

Example:
12/20/2007
Your Name
123 Somewhere St.
Here, OH 45111
Home Visit

12/20/2007
Someone Else
345 Anywhere St.
There, OH 45211
Hospital Visit

View 9 Replies View Related

Convert All CSV Files In A Folder To Excel Files?

Apr 8, 2014

I is it possible to convert all comma separated text files in a single folder in to excel files. But the requirement is to have 2 sheets in each new file. first to be the full file - with all columns, and in the second sheet to keep only colum A B D G H K L M O P R S T V W from the first sheet. The second sheet name must be the same as the first one but without the first "wlist_" in the name.

One more thing. The third column in the second is called "COUL". there are short letters for colors in french

can they be converted with the sort in English like it goes:

NO = B
BA = W
RG = R
SO = P
JA = Y
BE = L
VE = GY
GR = G
VI = V
MA = BR
BJ = TA
OR = O

Here is a link to the both CSV and an example excel file with the end result. In this example i haven`t change the shorts for the colors. It takes me too much time with the find and replace function. And at the moment i`m really pushed from time.

[URL]

View 9 Replies View Related

Array Calculation From 2 Files Without Opening Files?

Apr 2, 2014

I have 50 files each with 1000 numbers in column A.

I need to compare every list with every other list and calculate the Pearson function.

I am ok with the vb code to compare every file with everyother.

I can do this by opening each file then closing but it takes too long.

Each of the 50 csv file names is in my destination workbook

I would like to define an array using the file name, then extract 2 lists without opening the files then perform the pearson function and place the value in the destination workbook. (The pearson function just measures the strength of correlation between 2 sets of numbers)

View 4 Replies View Related

Saving Comma Separated .txt Files As .csv Files

Sep 15, 2009

I have a large number of .txt files that are comma separated files (but not saved with the .csv extension) that I need to convert to files with the .csv extension.

Is there an easy way to do this for all files in a given folder? Ideally, the files don't even need to be opened as they are are quite large in size (70MB+) and there are a lot of them (500+).

View 9 Replies View Related

Convert Multiple Files To Text Files

Sep 26, 2007

I have about 100 Excel files in one folder that need to be saved as text files. They can keep the same name, but simply need to be converted to text files. I'd like to use VBA for this and I can't find examples that do exactly that...or ones that my limited knowledge can handle.

Excel files exist in C:Source and ALL of them should be saved as text files in C:Destination. Maybe there is an easier way, but I thought for sure there was a routine I could use.

View 4 Replies View Related

Search CSV Files For Word & Make .xls Files Of Them

Jan 23, 2008

I have 22 CSV files. I want to search each of those files for a specific text string (ie: "profile" or "description"). When the macro finds the word in any one of the CSV files I want it to copy that complete csv worksheet and paste it into an excel xls file.

how I can go about doing this. Not also that while vlookup is possible, its very time consuming if i have to do this 50 times over and each time the csv files have different file names. that is why i want to search within a file (each file has its own unique identifying text string)

View 2 Replies View Related

Can't Scroll Back To Top

Dec 26, 2008

I have a spreadsheet with some scripting that automatically emails the report to whoever is on the sheet. I'm not sure what kind of scripting it is. I think my boss found it somewhere.

Whenever I scroll either down or up, the first 3 rows disappear and I'm not able to scroll back up. The scrollbar shows that I'm not at the top, but it won't let me go back up. The first 3 rows contain the button to send the email. If I close out without saving and open it again, its fine, until I scroll up or down.

View 4 Replies View Related

Back And Forth Between Workbooks

Feb 2, 2007

Copying information from various sheets from one workbook to paste into similar sheets in another workbook? It would involve switching back and forth between workbooks.

View 9 Replies View Related

One Hundred Back To 100

Sep 26, 2008

I found a way (on this board) to spell out numbers...I.E.: 140 = "One Hundred Forty" .

But is there a way to convert "One Hundred Forty" to 140 and format as a number or general or pretty much anything but text? I thought would be as easy as Cell Format > Number

View 9 Replies View Related

Back Draws

Dec 3, 2008

Back Draws! ...

View 9 Replies View Related

Want To Be Able To Open Csv Files And Save As Xls Files

Apr 21, 2009

I have the code below. It openes all csv files within a folder, then delete rows depending on the value of a cell. Now it needs to save the file as a xls file ....

View 9 Replies View Related

Convert Csv Files To Tab Delimited Files

Dec 21, 2007

I would like to be able to execute a command line that will convert an Excel csv file to an Excel file that is TAB delimited. In other words, replace the comma delimiter with a TAB delimiter without having to open the file in Excel. I am an inexperienced Excel user

View 2 Replies View Related

IF And Vlookup Functions Which Comes Back Yes Or No.

Sep 20, 2007

I have a spreadsheet with over 20,000 rows. From another spreadsheet I need to find if any of a list of 90 customers are within the first, using a simple IF and vlookup formula which comes back yes or no.

I am using: =IF(A2 = VLOOKUP(A2,ihcust!B:B,1),"YES","NO")

However, although this works when they are spelt exact in both sheets if they are not it will say no.
eg. If I was Looking up "Joe's Icecreams" from the list of 90 but in the other sheet it is listed as "Joe's Icecreams (admin)" it would not recognise it and come back no.

Is there away to get around this problem

View 9 Replies View Related

Making IF= Formulation Come Back As N/A

Nov 2, 2009

I am trying to create an IF formula so when i try to get the percentage change if lets say the 2008 number was 0 and the 2009 number increased by 9 than i would get an error so i want the if formula to come back as n/a.

View 5 Replies View Related

Go To Another Worksheet And Then Come Back To Original

Aug 21, 2014

I'm setting up a payroll for several employees in one workbook. I start from the particular employee's worksheet and then I need to go to another sheet where various information is stored and then come back to the original employee's sheet. The current macro works fine if the various information is stored on each employee's worksheet but I can't figure out how to go to another sheet and then come back to my active cell in employee sheet.

[Code] .....

View 14 Replies View Related







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