SaveAs Method Working In Both 2002 & 2000
Sep 19, 2007
We're gradually moving over to Excel 2007 (from 2002) at my workplace.
My problem is that I need to run macros on both versions but I'm having trouble with the SaveAs method.
I have Excel 2007 set to save automatically in Excel 97-2003 File Format but this doesn't seem to apply to files saved using VBA.
My original 2002 code is as follows:
Workbooks.Add
ActiveWorkbook.SaveAs Filename:="C:ReportsNewFile.xls"
and 2007
Workbooks.Add
ActiveWorkbook.SaveAs Filename:="C:ReportsNewFile.xls", FileFormat:=xlExcel8
How can I get it to switch depending on the version it's run on? Unfortunately Excel 2002 doesn't recognise '=xlExcel8' so I don't think I can use an If/Else statement on the version number.
View 10 Replies
ADVERTISEMENT
Jun 15, 2007
I am using the following code which works in microsoft 2002, but not in 2000. When I run it in 2000 it says " Named argument not found." The debugger highlights the line Set C through delete.
Sub DeleteRows()
Dim c As Range
With Worksheets("Sheet1").Range("A1", Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp))
Do
Set c = . Find(What:="", After:=[A1], LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not c Is Nothing Then c.Resize(12).EntireRow.Delete
Loop While Not c Is Nothing
End With
End Sub
View 7 Replies
View Related
Jul 24, 2012
I am trying to use a cell reference to have excel automatically Save a worksheet using a cell reference as the workbook name. When I step through the code and use the immediate window I get the correct name for the file (fname in this case) but as soon as Excel tries to save the file, I get an error.
Here is the code I am using:
fname = Sheet3.Range("I1").Value
ChDir "S:Op CostsBudget 2013Data"
MsgBox "The actice file will be saved as " & fname
ActiveWorkbook.SaveAs filename:= _
"S:Op CostsBudget 2013Data" & fname & ".xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
View 5 Replies
View Related
Mar 20, 2007
I have a Find Method routine in a procedure that works fine in xl2000, but fails in xl2003 with error code 9, subscript out of range.
Is there a different format for the Find Method in xl2003?
'code in xl2000
Dim CourseI As Range 'Students taking BusinessI
Dim CourseII As Range 'Students taking BusinessII
Dim BothCoursesTrue As Range
Dim Student As Range
'code
'code ...
For Each Student In CourseI
Set BothCoursesTrue = CourseII.Find(Student, LookIn:=xlValue, LookAt:=xlWhole)
If Not BothCoursesTrue Is Nothing Then Student.Offset(, 3) = 3
Next Student
View 8 Replies
View Related
Jul 8, 2006
I encounter error 1004 and copy method of range class failed in this VB routine:
fltPreviousValue = Range(varPreviousCell).Value
fltCurrentValue = Range(varCurrentCell).Value
fltNextValue = Range(varNextCell).Value
Range(varCurrentCell).Activate
If fltCurrentValue = RangeMax(ActiveCell.Offset(-2, 0), ActiveCell.Offset(2, 0)) And _
Range(varPreviousCell).Value < Range(varCurrentCell).Value And _
Range(varCurrentCell).Value >= Range(varNextCell).Value Then
Range(varCurrentCell).Select
Selection.Copy (ActiveCell.Offset(0, 6))
I am using Excel 2000 and the error occured at the last command, the bolded one.
View 9 Replies
View Related
Apr 25, 2008
I have constructed a macro, (with lots of help from the fine people on this site), and have distributed it to several people in the company. The macro was written in Excel 2003, and runs perfectly on all the machines running Excel 2003, but persons using Excel 2000 are getting a runtime error, variable not defined.
Is there a trick to getting a macro to run in both versions of Excel?
View 9 Replies
View Related
Feb 20, 2009
I am trying to send emails using a table in Xl2002 via outlook2002.
The code below is from Walkenbach's VBA Bible for Excel 2003 and I am getting "Uesr-type not defined" error with the 1st Dim statement.
Do I need a different statement such as set OutObj = blahblah or similar?? I have searche dthe net hi & lo for a solution to this problem & I do have JW's excel VBA bible.
Sub SendEmail()
'Uses early binding
'Requires a reference to the Outlook Object Library
Dim OutlookApp As Outlook.Application
Dim MItem As Outlook.MailItem
Dim cell As Range
Dim Subj As String
Dim EmailAddr As String
Dim Recipient As String
Dim Bonus As String
Dim Msg As String
View 9 Replies
View Related
Aug 24, 2007
I've got a macro called "onundo" that runs when Ctrl-Z is pressed, assigned using "application.onundo" My problem is that after the macro runs I need to set the undo button again with application.onundo, but it doesn't work. If I put application.undo into the immediate window after the macro runs then that works - am I doing something wrong?
View 4 Replies
View Related
Dec 14, 2008
Below is the code in which the macro is showing error
Run time error '1004'
Application-defined (or) Object defined error
View 8 Replies
View Related
Dec 10, 2008
I'm trying to get the Find and FindNext methods to work. Column C contains serial numbers and there's a chance that a serial number might appear more than once in the column. What I'm trying to do is get Excel to find the first occurance of the serial number, find what row it's on and then see if this matches the variable 'CurRowNo' (defined earlier in the code). If it doesn't I want it to look at the other occurances of the serial number, find what row they're on and see again if it matches CurRowNo.
The variable 'EngCount is the number of occurances of the serial number (also worked out earlier in the code). I've got the code below, but I get the error 'Method Range of Object Global Failed' on the FindNext line. I have no idea what this error means or why it's happening.
View 3 Replies
View Related
Apr 5, 2008
Is the Hlookup funktion not included in Excel 2002? I've been trying to run basic exemples from microsoft, and ones made by myself, and I just can't get it to work. Excel just keeps telling me that's it wrong in the formula. I really need hlookup work.
View 13 Replies
View Related
Nov 5, 2008
I hate this toolbar.
I have no need for it but would like it to remain in the list of available toolbars (eg when i go View>Toolbars).
When i uncheck it from the list it disappears (hooray!) but the little b*stard is always back on my screen the next time I open Excel (this is in contrast to any other toolbars I hide/make visible which are always hidden/visible as expected - hence I don't think it's an .xlb problem).
has anyone got an explanation as to why and, better yet, a way to get the problem child off of my Excel (without removing it from the toolbar menu list)? Because I'm at work I can't modify Registry settings by the way.
View 9 Replies
View Related
Feb 20, 2003
Is it true that the sheet protection in excel is practicaly none ?
Not even excel 2002 (XP) prevents simple cracking software from removing sheet protection.
Are there any master keys that cause that ?
Is there a way to protect a sheet with strong encryption ?
View 8 Replies
View Related
Jun 27, 2008
I have a workbook in xl2002 that has a data sheet with approx 50 columns and 500 rows which is populated from a querytable querying another workbook. There are no formulas on this data sheet.
I have another 5 sheets, only one of which actually has formulas on it and these refer to the Data sheet above (some fairly beefy Sumproduct formulas in the main, but only 1056 in total (only about 650 of these are Sumproducts - the remainder are simple = A1 type or Match formulas with the third argument as True (ie quite efficient)).
There are also 3 dynamic named ranges in the workbook, which are utilised by the Sumproducts/matches. An example Sumproduc is as follows:....
View 9 Replies
View Related
Aug 14, 2008
I have excel 2002 XP Professional, and the problem I am having is that Excel keeps saying I am using 65536 cells but I am only using 1406, I have tried pressing clear contents on them and delete, but this only makes it lag for 15 minutes and still says the same.
Code:
View 9 Replies
View Related
Sep 1, 2008
I am creating a financial summary on a worksheet and I want to be able to write up a summary about each category. Is there a way that I could write text on my worksheet and create a parameter where my text could go to the next line such as a word document?
View 9 Replies
View Related
Mar 6, 2006
I have a report with details for a large number of countries. Each month, I need to copy the country details and move them to a sheet specific to that country,
e.g. UK details to a UK folder, Germany details to a DE folder. The level of details available is different for each country. So there may be 10 lines for the UK but only 5 for Germany. However, the country details always start with (e.g.) 'COUNTRY: UK' and end with ' TOTAL FOR: UK.'
View 9 Replies
View Related
Jul 20, 2013
I am using excel 2002 and I have found that when the workbook is shared and getting 2 or more users to open the workbook around the same time brings up a read only type prompt box for the 2nd ( and 3rd) user when the book hasn't fully opened for the 1st user/is still fully opening. Is this a limitation within excel or is there a way around this for example via vb code.
I know the more data a workbook has can cause it open a lot slower but is this the same for shared mode.
View 5 Replies
View Related
May 27, 2012
In a worksheet the data (text or numerical) from five columns are compared using the following formula.
=IF($A10$G10,"1ERROR",IF($B10$H10,"2ERROR",IF($C10$I10,"3ERROR",IF($D10$J10,"4ERROR",IF($E10$K10,"5ERROR","-")))))
The formula is working well. The problem is I get the result for the first column of error even if the error is in more than one column. I want the result should display all the errors with the column number 1, 2, 3 (or with column name A, B, C etc). The total number of error is not required. The exact columns which have the error should be displayed. For example if the error exists in 3, 4 and 5 columns, I should get the result as "345Error" or "CDEError".I use excel 2002.
View 6 Replies
View Related
Oct 8, 2012
I've got Excel 2002. I am devising a sheet for checking work (sheet A) which feeds onto a separate sheet (sheet B). If I wanted to delete info from sheet A can I retain the info on sheet B? I want sheet A to be used repeatedly for each case but the info for every case to be recorded row by row on sheet B.
View 4 Replies
View Related
Jun 11, 2013
I'm currently trying to set up a spreadsheet on excel, when certain documents need updating. Basically I have a column with the dates in that each document was last updated, I want the cells to turn red (fill colour) if the document has not been updated within the last 6 months and orange (fill colour) if the document has not been updated in the last 4 months. How do I do this?
I am currently using Excel 2002 and am on a Windows XP computer.
View 1 Replies
View Related
Apr 2, 2008
Need the formula to turn a date into a quarter and year
1/15/2003 would be 1Q2003
5/15/2005 would be 2Q2005
11/10/2007 would be 4Q2007
View 9 Replies
View Related
Jan 25, 2012
Excel 2002.I have data in columns A and B on sheet 3, starting at row 100. The total number of rows of data is variable (max is 50 rows). I want to take the values in A100:B100 and copy them from Sheet3 and paste values transposed to SheetTL Range C1:C2. I have started to write the following code but as you can see I will have to repeat the code upwards of 50 times. It seems I should be able to do a COUNT function to see how many rows of data exist and then somehow loop the code to copy the data from each subsequent row that many times, but how to put that together.
Sheets("Sheet3").Range("A100:B100").Copy
Sheets("TL").Range("C1").PasteSpecial Paste:=xlPasteValues, Transpose:=True
ActiveSheet.PrintOut
If Sheets("Sheet3").Range("A101") = "" Then
[Code] .........
View 5 Replies
View Related
Jan 26, 2012
I have a workbook in which there is a sheet containing a table.
Excel 2002ABC123Specific Gravity6 Volt ValuesSOC40.0000.000Dead
51.1345.97010%61.1485.99020%71.1626.02030%81.1766.06040%91.1906.10050%101.1976.12055%
111.2046.14060%121.2116.16065%131.2186.18070%141.2256.20075%151.2336.23080%161.2416.26085%
171.2496.31290%181.2576.32095%191.2656.350100%SOC Chart
From another sheet I query this table using the LOOKUP function to obtain values from column C such as 25% 60% and so on. A typical query formula looks like this:
=LOOKUP(B2,'SOC Chart'!B4:'SOC Chart'!C19)
It would be nice if the fill color came along with the value.
View 3 Replies
View Related
Feb 3, 2013
I found in an old file that i triggered the macro by clicking a button! I would post a pic but i don't know how. How do I activate a macro by clicking a shape on the excel 2002 page?
View 7 Replies
View Related
Sep 10, 2013
Basically, I have an excel spreadsheet with different valued items for example,
TV Essential l £15
TV Essential extra l £20
Broadband Essential l £ 8
Broadband Extra l £12
I have options for TV, Broadband and Phone. At the bottom of the spreadsheet I want three drop down lists to pick what TV, Broadband and Phone package I want. For example: TV Essential, Broadband Extra and Phone Weekend. I can create the lists but I was wondering if there was anyway where, as you select the option on each of the lists, a running total will be created. So when TV Essential is selected £15 is added to a cell, say F20. Then when Broadband Extra is selected another £12 is added to cell F20. And as you select different ones in each list the total in F20 changes.
I'm using Excel 2002.
View 1 Replies
View Related
Oct 28, 2008
My workbook holds a month template and sheets for each month. I work on modifications in the template ,but would then like to update all the monthly worksheets. I recorded a macro to show me how to start programming the vb sub, but get a runtime failure 'error 1004 Select method of range class failed' when trying to select the column to copy,
View 4 Replies
View Related
Jan 14, 2011
what format is used when you save an excel file as "unicode." I am using excel 2002 on XP.
I have been asked to provide a UTF-8 formatted unicode file for use by another program but I am not sure which formatting excel uses.
View 3 Replies
View Related
Jan 20, 2012
I've got some code which some one posted me a link to on here which set up a pivot table on more that 1 sheets (using excel 2002).
I inserted this code into a rountine I do daily which works fine.
The problem Im having is that Im getting more and more info which I need to pivot over more than one sheet. So I was going to amend the rountine so It picked what ever sheets are in the work book to pivot.
At the moment I have to go into the code and name the sheets to pivot. Is there some code which can work out how many sheets that need pivoting and just do it with out naming them? and also just add a new sheet with the pivot on rather than having to name the destination?
I've posted the code i got given below and have highlighted the bit where I have to name the sheets.
Code:
'---------------------------------------------------------------------------------------
' Procedure : CreateConnection
' Author : KL (Kirill Lapin)
' Date : 18/08/2009
[Code]....
View 8 Replies
View Related
Apr 21, 2012
I am using the following formula to find out the No. of "HH" in the range given and I am getting the results simply with numerical value as 2, 3 etc. I want the result should be displayed as 2HH, 3HH depending upon the No. of "HH" available in the given range. The result should be displayed as (the No. added with the text "HH").
=IF(AND(DJ10="HH"),COUNTIF(DF10:DJ10,"HH"),"-")
I use excel 2002.
View 2 Replies
View Related