Looping Through Files And Suppressing Errors
Apr 10, 2007
I need to convert about 10,000 lotus files to excel files and strip them of any formulas. What I currently have is the part of the macro that will loop through the worksheets (theres about 20 worksheets per workbook) and strip the formulas while leaving the data in tact.
What I need is to learn how to write a loop that will search through folders for Lotus (wk4) files, open them one at a time, run my macro, save them as excel workbooks to a different folder. While suppressing a pretty healthy number of error messages when open and saving the files. Including an update/don't update pop up when opening some of them. I don't want to update.
The looping files and opening lotus is the most important part to me.
View 7 Replies
ADVERTISEMENT
Jul 27, 2008
i have this code which looks in a folder and moves all .csv files from folder into workbook. The code uses an Array.
If the code does not find a file in the folder (from the array) it returns an error. How can i modify this so that (if a file is not found from the array) then the code still continues without generating errors?
This is the ....
View 9 Replies
View Related
Aug 22, 2013
I wrote the following routine to loop files in folder. I have 4 .xls files in my test folder. This code is only grabbing 1 then exiting. I have used the Dir() loop before with no problems.
Code:
Private Sub GetDataMultipleFiles(ByVal importExt As String, ByVal xFileNum As Integer, ByVal importLoc As String)
Dim Sep As String, myFile As String
Sep = Application.PathSeparator
myFile = Dir(importLoc & Sep & "*" & importExt & "*")
Do While Len(myFile) > 0
[Code] ..........
View 2 Replies
View Related
Jun 5, 2008
I have written a routine that prompts the user to select an Excel file (using Application. GetOpenFilename) then the routine pulls information from the selected file. I now want to have the user only select the folder and then have the routine loop through every file in the directory, pulling the information from each.
View 9 Replies
View Related
May 1, 2013
I'm trying to code a macro to search through all the files in certain folders to find a value defined by the user. The rows containing that value will then be copied and pasted into a separate workbook. My boss currently planning on storing about 550 different files (90 days worth of data) between these folders, but there is the possibility of years worth of data collection, should he change his mind about the 90 days, so I'd like the code to be efficient if possible. What I've tried to do is search each file for the value, then set a range equal the first row containing that value. If the value is found in that workbook, the code loops through the worksheet, adding all the other rows with that value to the range. Then the file looping exits (the values I'm looking for are only contained in one of the workbooks) and the range is copied and pasted into the master workbook. Each workbook has only one sheet.
I'm currently getting a run-time error "13" Type Mismatch error when it gets to the line where the code is supposed to find the value and initialize the range.
Code:
Private Sub SubmitButton_Click()
Dim mybook As Workbook
Dim masterbook As Workbook
Dim rownunm As Long
Dim pathparts(1 To 5) As String
[Code] ......
View 3 Replies
View Related
May 29, 2009
I want to link a worksheet to another workbook; where any changes that I make in the worksheet automatically updates the workbook. I used the 'Paste Special' which worked but I don't want all the 0000 that are entered in the cells. How do I link without all the 0's?
View 4 Replies
View Related
Mar 21, 2007
i'm coping a file over itself and i get an information message "File cannot be copied onto itself" - An attempt to copy a file could not be completed because the file already exists or same source and destination.
i would like to surpress this, i have tried the following, but to no avail:
Application.DisplayAlerts = False
Application. ScreenUpdating = False
Application.Interactive = False
?
View 3 Replies
View Related
Aug 15, 2007
I'm struggling with an alternative method of suppressing the # DIV/0 in my worksheet. I'm familiar with the ISERROR function and it's use as well as using =IF(A2=0,"",A1/A2), however I'm still getting #DIV/0 errors and I can't use ISERROR because
I have exceeded the number of nested IF's.
I've attached an example. In the example, the only time the #DIV/0 appears is when "Y" appears in the Commit and In-House column for all rows. This is the condition I'm trying to suppress the #DIV/0 error for.
All the formula's I'm using are Array Formula, as are all my attempts to suppress the error....
View 9 Replies
View Related
Mar 24, 2014
Basically upon opening my workbook, I have some code that runs to loop through all the sheets and make certain sheets visible based upon which password the user enters. However, I also have some code upon activation of some of these sheets to have a msgbox pop up explaining what the sheet is about. I obviously dont want these to appear when the initial loops is going through activating the sheets one by one - I only want these msgboxes to appear when the user subsequently opens one of these sheets.
View 4 Replies
View Related
Sep 11, 2009
Column M of Sheet 1 contains either "y" or "n". I'd like Sheet 2 to populate with data in cells A-D but only for rows where column H = "y". I can figure out the condition easily enough: =IF('Sheet 1'!M2="Y",'Sheet1'!A2,"")
Repeat for each column to display. But I'd like to suppress the blank rows for both display purposes and the possibility of using in a Word mail merge.
View 2 Replies
View Related
Nov 11, 2013
Context: I'm pulling a data set "A" into excel from MS SQL (currently 48,000 rows ... comes back in < 10s). I will add a field "Cost" to data set "A" that uses info from that data set to look up a value in data set "B" which is in another Excel Sheet and perform a calculation. The sheet that contains data set "B" may or may not be in the same file - haven't decided yet but I'm not really concerned about that.
I actually have the calculated "Cost" field added to the end of data set "A". When I refresh the data, the fomulas recalculate.
My intent from here is to present the data in a pivot table. I will add a "Refresh Data" command button that:
1. Updates the data from MS SQL
2. Refreshes the pivot
I've done 1&2 many times before and have code I'll reuse.
The problem: I cannot present a pivot sourced straight off the amended data set "A" because it contains fields that should not be accessible by the audience for this report (as a matter of policy). I haven't found a way to hide/suppress source fields in a pivot table so I'm guessing that it is not possible. So I need to somehow get to a dataset that I can use to source my pivot which does not include the confidential data but includes my calculation.
Options I'm considering:Via VBA: Create a copy of Data Set A (including my cost field) as Table C on another sheet and remove the confidential columns from the table. The Pivot Table would be sourced against TAble C. My assumption is that I'd have to be very careful with how I clear out and re-populate table C as not to have to "start over" with my Pivot Table each time it is refreshed. Ideally the pivot design would look just as it did before the user hit the "Refresh Data" button (other than it has the updated data).Order my fields in data set A (with the calculated field) such that I can define a named range that is the source for pivot table. The range would exclude the confidential fields. The Refresh Data macro will just need to resize the named range after the data is refreshed from SQL server. With this option, I just have trouble trusting that excel will never arbitrarily change the field order when I refresh the data connection.Create Data Set C using another query from SQL Server that only has the fields that I want available in the pivot plus a "sumproduct" formula that gets cost from Data Set A. The Refresh Data macro would refresh A then C then the Pivot table. What I don't like about this is having to keep the 2 queries in sync -- there is not a large risk of these queries needing to change, but you never know.
View 4 Replies
View Related
Dec 5, 2009
In cells BS8 I have the following =100*SUBSTITUTE(BR16,"metres","") to get centremetres from cell BR8 and in cell BT8 I have the following
=IF(BS8,ROUND('Under 6 Boys'!D11*(BS8-'Under 6 Boys'!E11)^'Under 6 Boys'!F11,0),"") I get a #Value error
I have also tried
=ROUND('Under 6 Boys'!D11*(BS8-'Under 6 Boys'!E11)^'Under 6 Boys'!F11,0)
In BT8 but I get same error
I have used it in another sheetsheet and it works I don’t understand why is is happening ...
View 12 Replies
View Related
Jul 4, 2008
I am using a combination of validation, vlookup and simple formulas to lay out a workorder. If I leave something blank in one of the feilds then everything that comes after say #n/a and won't allow the calculation to complete. Is there a way I can set a default value or something so to make calculate all the feilds that ARE filled in?
View 9 Replies
View Related
Sep 21, 2009
I have a workbook with data tabs (one shown here) and a summary tab. Essentially, one inputs hours for people in the Data tab (Tech) that are then calculated/summed to total $ based on rates I have hidden elsewhere in the workbook (not included). I'm trying to bring the subtotal lines (highlighted green) into the Summary tab based on which subtotal and what month/year it is. My formula works fine, except for the fact that it is returning a #Value! due to the "Hrs" heading for each Phase. I don't know why it's doing this because I've not run into sum array issues when mixing numbers and letters before. The error formula is highlighted in yellow in my attached sample, but below is a copy of the formula.
View 10 Replies
View Related
Dec 31, 2009
I can not get the following formula to work - I keep getting #Value errors and I've checked the fields and the values are correct
=SUM(IF(Input!$A$6:$A$4006=1,IF(Input!$I$6:$I$4006="DM",IF(Input!$K$6:$K$4006="Bid",Input!$L$6:$L$40 06,0),0),0))
My intension is that if A=1 and I=DM and K=bid then add the corresponding values in L and display. I can't figure out why this formula in another cell and works fine
=SUM(IF(Input!$A$6:$A$4006>0,IF(Input!$A$6:$A$4006<1,IF(Input!$I$6:$I$4006="DM",IF(Input!$K$6:$K$400 6="Bid",Input!$L$6:$L$4006,0),0),0),0))
it is just checking an additional condition of the value in column A
View 4 Replies
View Related
Mar 6, 2009
I am using a SUM function with multiple conditions as an array formula.
View 14 Replies
View Related
Jan 16, 2010
I am creating a spreadsheet which shows the date of when the training was cpmpleted. I have added an expiry column which gives the date 3 years from start date no problems. The trouble i am having is that the column will return an #VALUE when no training date is entered. ie: the person has had no training so no date can be entered.
View 11 Replies
View Related
Apr 4, 2008
I've been using some code I wrote at the start of March to open some files that I've created earlier in the day in order to add to them.
The code worked fine until the month changed. Here is the code I have to open the file I need.
strdate = Format(Now, "dd-mmmm-yyyy")
ChDir "C:DesktopTodays ReportsReports " & strdate & ""
Workbooks.Open Filename:= _
"C:\DesktopTodays ReportsReports " & strdate & "Date Report " & strdate & ".xls"
Since April 1st I have been getting a compile error saying I have the "wrong number of arguments or invalid property assignment".
I am at a loss as to why the code doesn't wok as nothing chaged between March 31st and April 1st.
View 9 Replies
View Related
Feb 16, 2010
Having a strange problem with vLOOKUP. Please see the attached file. The result is in cell M1 of the sheet (Link to the file below).
Vlookup works fine if the data is entered manually in cell H1, but with the formula it errors up .how i could make this work with the formula?
View 9 Replies
View Related
Mar 22, 2007
Sub indX()
For rwindex = 1 To 4
For collindex = 1 To 10
With Worksheets("sheet1"). cell(rwindex.collndex)
If Value < 0.001 Then .Value = 0
endwith
Next collndex
Next rw
End Sub
I have a code here and i have to spot what the errors are.
I know there is an error with 'endwith' but not sure what to do to fix it
View 6 Replies
View Related
Apr 3, 2008
What i'm looking to do is input a VBA command to comb the activesheet (which contains approximately 1400 rows, and 32 columns of mixed data and formulas), and determine if the text value "#N/A" appears anywhere on the sheet. If it occurs one or more times, i want it to set a boolean flag to true.
I know of ways to do so by setting a = countif(A:AG,"#N/A") formula in a cell, but unfortunately this is not my solution here, as it needs to be done before the formula is converted to text. A countif does not show a visible value of #N/A if its true value is a formula.
View 9 Replies
View Related
Mar 2, 2009
I've got a bunch of formulas that often are trying to divide by zero, hence this error in the cell. Is there an easy way to modify the forumla or format so that if a division by zero is attempted, the cell can show a zero instead of this error?
View 4 Replies
View Related
Nov 16, 2009
When I run a report, for some reason our system imports certain numbers which have errors, as a consequence when I try and do a pivot table I get a lot of returns showing #div/o!. If you look at the spreadsheet the errors start on line 103 sheet 2 and finish on 2631. Sometime the report can be huge and takes a while to go through these manually to convert to numbers.
View 3 Replies
View Related
Nov 17, 2009
I have the formula =today()-g3 which works fine to let me know how many days a loan has been out. However when there is no date in column g i get #value! errors. Can anyone reccomend an alteration to the formula to avoid these errors showing up as they dont look great.
View 2 Replies
View Related
Feb 17, 2014
The following formulas is showing error in some cells?
=IF(ISTEXT(PRONOSTICOS!G5), PRONOSTICOS!G5, "")
View 3 Replies
View Related
Jan 13, 2014
I entered an activex object command thing.. and now I'm not sure how to exit out of it.. it just keeps alerting errors messages like reference is not valid and other ones depending on what I type in the formula box.
I just want to remove the object, but I can't get past the error alerts.. they just keep coming every single time I click somewhere on the workbook trying to exit out of it.. so I'm not sure how to even get out of it.. I don't want to open up Task Manager to exit out of the entire program because I didn't save my workbook.
View 2 Replies
View Related
Apr 29, 2014
I am brand new (Day 1) to VBA programming and I am running into an issue when trying to activate a sheet based on the value chosen in my userForm that I cannot seem to solve. The error seems to be a compile error and says I am missing and End statement to one of my If Then statements, specifically:
Compile error: End If without block If
I thought if the If Then statement was all on one line that I would not need an End If statement. In fact, if I try to add an End If statement, I get an error (all proceeding text turns red).
This is the part of the code with the End If error.
[Code] .....
View 14 Replies
View Related
Jul 10, 2014
I have developed a process design application in Excel using User Forms to input data. The data are placed on a sheet of a workbook with the majority of the calculations being done by cell-to-cell calculations so that users can view the formulas if they so desire. This application works well in English. We want to use the same application in our German office where it has not worked well.
In order to trouble shoot the problems, I can go to the Region and Language setting under Control Panel and set it to German (Germany). This converts the number format to a period for the thousands separator and a comma for the decimal. This seems to create a lot of problems for VBA that I have not been able to sort out.
To simplify the problem I have written a very simple program. It has one User Form with two text boxes for number input, an Enter command button and a Close command button. Sheet 1 has a command button that opens the User Form. In the User Form, I enter a number in both text boxes and click Enter. VBA code then enters the number from Text Box 1 in Cell A1 and the number from Text Box 2 in Cell A2. Cell A3 has an equation that calculates the sum of A1 and A2. All cells are formatted as General.
The workbook works as expected in English. When I set my PC to German (Germany) the application works as expected when I enter an integer in the text boxes. However, if I enter a decimal such as, in the German format, 10,5 and 5,5, the numbers entered into the spreadsheet are text (left justified) and the sum is zero. I have to enter 10.5 and 5.5 to get the numbers to enter as actual numbers and give the correct sum.
How to make VBA work with the German settings?
View 1 Replies
View Related
Jan 15, 2010
I need a formula that will check a few things and if it finds an error the word error will appear in the cell, the details of which are in the attached spreadsheet.
I have worked on this a great deal and cannot seem to make a formula with the proper logic. There is a sample of an error in the spreadsheet.
View 4 Replies
View Related
Feb 3, 2010
I have a workbook that contains several formulas that return #value! errors. My formulas are correct and I can remove the error by using an "if" function, but there are a lot of these cells. I just want to make the error show blank to make my workbook look nicer without having to write formulas to avoid the error messages. Is there something I can add in the VBA worksheet function to turn off these errors?
View 2 Replies
View Related