Change History Duration Error '1004'
May 25, 2006
I encounter an problem when I migrate the excel application from excel 97 to excel 2000. The application basically composed of VB6 and VBA. When the program execute to line "ChangeHistoryDuration", i.e.
'Turn On the Audit
ExlApp. ActiveWorkbook.KeepChangeHistory = True
ExlApp.ActiveWorkbook.ChangeHistoryDuration = gi_duration
ExlApp.ActiveWorkbook. SaveAs w_filename, , gs_open_pwd, gs_write_pwd, , , xlShared
Run-time Error '1004', Method 'ChangeHistoryDuration' of object '_Workbook' faild was found. However, it runs successfully in excel 97. Does anyone know the possible problem that cause such error.
View 4 Replies
ADVERTISEMENT
Jan 3, 2013
The following code works fine, but when I put the code in an ActiveX Combobox Change Event it gives a run-time error 1004. ("Select Method of Range class failed")The error occurs on the following line
Code:
Worksheets("SAVED").Range("A" & l).Select
Code:
Dim l As Long
Application.ScreenUpdating = False
l = Application.WorksheetFunction.Match(Worksheets("DATA").Range("O34"), Worksheets("SAVED").Range("A1:A10000"), 0)
Worksheets("SAVED").Activate
'ROSTER===
Worksheets("SAVED").Range("A" & l).Select
Selection.Resize(1, 739).Offset(1, 2).Copy
[code]......
View 2 Replies
View Related
Jan 10, 2007
Run-Time error '1004':
Method 'Range' of object'_worksheet' failed
The Function basically takes any cell in range with a formula and has it blue. If the formula is overwritten by the user it turns the cells colour Red.
Private Sub Worksheet_Change(ByVal Target As Range)
'change Colour of cells from blue if formula based to red if data typed by user
If Not Intersect(Target, Range("AS63,BA5:BP66,BT7:CI55,BU60:BU64,BX60:BX64,CA60:CA64,CD60:CD64,BT55:CI66,BT59:CI59,CF7:CF55,CF65:CF66,DJ19:DJ21,DJ24,DL5:DM36,DJ41,DJ45,DJ48,DL41:DM48,DH50:DH51,DJ50:DJ51,DL50:DM53,DH63,DJ63,DL55:DM58,DL60:DM66,DU5:DV33,DU37:DV58,DZ8:EB8,ED5:EE27,ED31:EE66,EM5:EN12,EM16:EN29,EM33:EN38,DH63,AL5:AM26,AL30:AM49,AL53:AM66,AV5:AW16,AV20:AW29,AV33:AW53,AV55:AW63,CO5:CO66,CQ5:CR66,CY5:CY66,DA5:DB66,DJ5:DJ7,DJ14:DJ15,DJ17")) Is Nothing Then
If Target.HasFormula Then
Target.Font.ColorIndex = 11
Else
Target.Font.ColorIndex = 3
End If
End If
End Sub
View 4 Replies
View Related
Dec 22, 2011
I am getting Run-time error 1004 "Cannot Change Part of a Merged Cell". I am trying to copy Sheet1 cell E11 (merged cells E11:G11) to Sheet2 cell E11 (merged cells E11:G11).
Sub PartBalance()
With Sheets("PART REQUEST")
If Range("D11").Value - Range("K11").Value 0 Then
[Code]....
View 3 Replies
View Related
Jan 9, 2013
I have been facing a run time error 1004 ("Cannot change part of a merge cell") when I am to run the following code. I have some merged cells in my excel sheet.
Sub Save2013()Sheets("Invoice").Range("I25:I33").ClearContents
Sheets("Invoice").Range("K25:K33").ClearContents
Sheets("Invoice").Range("K15:M19").ClearContents
Sheets("Invoice").Range("E15:G17").ClearContents
Sheets("String").Range("I58:J58").ClearContents
Sheets("Invoice").Range("T14:V1419").ClearContents
ActiveWorkbook.SaveEnd Sub
View 1 Replies
View Related
Nov 1, 2006
When I paste data in Sheet2 in the attached CF Example2 file (Just by Selecting A1:L18 Cutting it and Pasting in the same place), the action of the VBA code in the Thisworkbook is correct but I am getting the 1004 Error Message from the VBA debugger saying "Run-time Error '1004': Application-defined or object-defined error
View 2 Replies
View Related
Mar 9, 2007
I had to add a column to all worksheets... so edited the code so it would still refer to the correct cell. I changed the two references to "K54", to "L54"... but following this change, I get an 1004 error stating "Select method of Worksheet class failed", and the following line is hi-lighted.
ws.Select Replace:=False
Sub PrntUsedShts()
Application. ScreenUpdating = False
'set page counter
Dim PgCnt As Integer
PgCnt = 0
'select sheets to print
For Each ws In ActiveWorkbook.Sheets
If ws.Range("L54").Value > 0 Then
ws.Select
Exit For
End If
Next ws...............
View 4 Replies
View Related
Jul 2, 2006
the if stattement works perfectly and does exactly what i want except when it comes to the else part. if there is no error the statements are run perfectly but if there is an error (in this case the error is generated when a match cannot be found in the spreadsheet) the else statement doesnt kick in and post the msgbox.
the code just crashes. and returns an error 1004 on the line i have highlighted in yellow
res = WorksheetFunction.Match(invvar, Columns(1), 0)
If Not IsError(res) Then
Me.txtClientID.Value = ws13. Cells(res, 7)
Me.txtNumber.Value = ws13.Cells(res, 7)
Me.txtDate.Value = ws13.Cells(res, 8)
'save client id as a variable
'Print to invoice------------------------------------------------------------------.....................
View 6 Replies
View Related
Aug 19, 2009
Before I go into details I am working in one workbook with several worksheets(Tabs) in the workbook. I have three Buttons on one tab. the button I am having trouble with is the third. I want to insert a column in a separate tab that contains approximately 87,000 rows of data. I then want to do a row count and select the empty cells in the inserted column and put a formula in there. I have tried a loop VBA code and it works, but it takes about 30 minutes to run all the way through. The underlined portion is what is higlighted with error 1004: Application-defined ro object-defined error. I am not sure how to fix this. This is what I have now:
View 13 Replies
View Related
Jan 17, 2008
I'm using VB 6.5 and Excel 2007. I've got a workbook that has code that creates another workbook (by copying sheets out of the current workbook) and drops a button on that workbook and creates a macro for that button. Everything works except one thing which gives me
Runtime Error 1004: Unable to update the Caption Property of the Button Class.
If I run the code manually (rather than calling the subroutine from from within another subroutine) it runs without error but if I call it from within the subroutine that copies sheets from the original workbook to a new workbook I get the error. Any idea why this might be? What I might be doing wrong? The code for this subroutine is as follows:
Sub CreateButton()
Dim btnMyButton As Button
Set btnMyButton = ActiveSheet.Buttons.Add(460, 75, 140, 30)
btnMyButton.Caption = "Delete and Update Charts and Lists"
End Sub
View 9 Replies
View Related
Mar 5, 2013
I have a relatively complex report that I work with and a worksheet is no longer required. I have deleted the worksheet and reference to it hwoever when running the macro to pull all the data, it gets to the summary of all the data and i get the Run Time Error 1004 Application-defined or object-defined error pop up. ON reviewing it, it is on this line ActiveCell.Offset(0, 0).Range("a1:a" & Range_Height).Select of the below code...
VB:
Sub GetRangeName()
Sheets("TOTAL").Select
[Code].....
use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window.
View 1 Replies
View Related
Apr 26, 2009
I have a simple function below to put in different forumlas in different cells to get stock quotes. When I run this I get runtime error 1004 application-defined or object-defined error. The first formula goes through but vba chokes on the next formula: ActiveCell.Offset(I - 1, 4).Formula = username
View 10 Replies
View Related
Aug 12, 2009
Run-time error '1004' Application-defined or object-defined error. I am trying to use this
View 2 Replies
View Related
Oct 4, 2009
I was trying to use the below code
View 4 Replies
View Related
Dec 4, 2009
I keep getting a Run Time Error 1004 (Application Defined or Object Defined Error) when my sub reaches this line:
ActiveCell.Formula = "=SUM(D222,D224,D226,D227,D229,...)"
In the actual line of code the "..." above is another 20-30 or so cells in column "D". Probably no more than 150-170 characters in the line.
If I remove half of the cell range names it works, but I need all of the cell ranges for the equation.
View 9 Replies
View Related
Jul 24, 2007
I am trying to copy the info from one workbook to another workbook.
I keep getting the above referenced error...
Private Sub CommandButton1_Click()
Dim filepath As String
filepath = Range("A100")
MsgBox ("File Appended")
Workbooks.Open (filepath)
Windows("CorrespondenceMaster.xls").Activate
Sheets("Sheet2").Select
Range("DesNo", "LocationPath").Select
Selection.Copy
Windows(filepath).Activate
Range("A2").Select
ActiveSheet.Paste
End Sub
View 3 Replies
View Related
Apr 9, 2014
I have a sheet that will force user to enable macro before revealing the sheets and enabling them to key in data. But because I need to protect the workbook from user deleting sheets and also having some locked cells. I got the run-time error 1004 unable to set visual property of worksheet class
View 1 Replies
View Related
Jan 12, 2007
Is there a limit on the amout of pictures you can use with the statement me.pictures.visible? Reason being, I am trying to import 119 pictures into a spreadsheet. When the information is selected form a drop down list, it pulls up the 1 of the 119 pictures. I was able to get 54 pictures input. Everything was going great until the 55th. When it stared giving me an error...
______________________________________________
Runtime Error '1004':
Unable to set the Visible property of the Pictures class
______________________________________________
When I select Debug, it takes me to the line with Me.Pictures.Visible = False
Everything seems to work fine until I enter the 55th picture. If it is that, is there a viable work around?
View 9 Replies
View Related
May 5, 2014
the problem I'm having is that when trying to copy the value of cell A2 and paste it in cell A4 with (INSERT with the second button of the sheet). this give me the error RUN TIME ERROR '1004 '.
View 7 Replies
View Related
Feb 22, 2007
Getting a error message when opening a workbook "Runtime error 1004" I dont know much about excel and the user explained it to me as best she could . Here is where the script bugs:
Sub auto_open()
fdist = ActiveWorkbook.Name
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Worksheets("f_cumul").Cells.ClearContents
Worksheets("f_cumul").Cells.ClearFormats
Worksheets("vtes_dj").Select
Range("a1").Select
Selection.End(xlDown).Select..............
View 9 Replies
View Related
Jul 24, 2008
having a nightmare with a pivottable in VBA. I cannot give it a dynamic datasource. Surely i must be coding this wrong.
it breaks on setting the range for PTRange with the error
Run Time Error '1004'
application-defined or object-defined error
View 10 Replies
View Related
Dec 3, 2009
When I run the following macro i receive the following error
Runtime Error '1004'
Method 'Range' of object '_Global' failed
View 7 Replies
View Related
Dec 7, 2009
I'm trying to create a macro that will take a worksheet from an Excel workbook, and save it as a text file, with the name determined from user input, and the location being the desktop of the currnet user's computer.
First I use a function, (provided by RoyUK), to get the name of the current desktop, then I try to use that name, along with my user input, so save the file. Obviously, it's not working, or I wouldn't be here. I get a "Run-time error '1004': The file could nto be accessed". I think it's just a syntax issue with the file name, because debug takes me to the "SaveAs" portion of the macro.
View 2 Replies
View Related
Dec 8, 2009
I have a freaking problem coming from a Web Query. Actually, I get an "Execution Error 1004" because of the following piece of
View 7 Replies
View Related
Dec 10, 2012
Im almost finished my first code where the basic idea was to make activecell.name=activecell.value in the first column for the first 3 sheets. After messing with it i figured i couldnt have spaces in the cell name...then i learned i couldnt have random '()-'/ either. So i have the code formatted to do that and then its supposed to call to rename everything as well. but after the 1 sheets column is renamed the 2nd sheet gets error 1004 when range("A3").select is hit. What gives?
This is what ill be using the code on
[URL]
Here is the code
Code:
Sub RemoveChars()
' Works through first 3 sheets '
Sheets(1).Select
[Code]....
View 2 Replies
View Related
Apr 21, 2014
When I run the following code it keeps giving me a runtime error 1004.
Code:
Sub ImportData()
Dim fNameAndPath As Variant
Dim wb As Workbook
Dim cNextRow As Long
Dim Ans As String
NextRow = ThisWorkbook.Worksheets("Errors").Range("B" & Rows.Count).End(xlUp).Row + 1
cNextRow = ThisWorkbook.Worksheets("Compare").Range("A" & Rows.Count).End(xlUp).Row + 1
[code]...
View 3 Replies
View Related
Feb 11, 2007
Windows("VCS.xls").Activate
Range("C6:C20").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=aantal.als($C$6:$C$20;C6)=1"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
When i start this macro i get an error in line ".Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=aantal.als($C$6:$C$20;C6)=1" (aantal.als = count.if)
The error i get is 1004, "Door de toepassing of door object gedefineerde fout".
Sorry i don't know what the english translation is.
When i put this validation manualy it's working fine, what's wrong in the code, am i missing something?
View 9 Replies
View Related
Aug 16, 2007
When running a Macro I am getting an error message as follows:
Run-time error '1004':SQL Syntax error
The line of code which appears to be effected is:
.refresh Backgroundquery:=False
I dont really know what this part of the code is trying to do and why it is highlighted yellow when I try and run the code. I am basically importing data from Access to Excel and this line is the last line of the code. If I remove this line, the error does not occur and the code completes. However, the data from Access is not imported so I am assuming it is an important part of the code!
View 9 Replies
View Related
Feb 15, 2008
I have this macro and I keep getting a 1004 runtime error 'PasteSpecial method of range class failed' on the highlighted line,
Sub Print_()
'
Sheets("Sheet1").Select
Cells.Select
Selection.Copy
Sheets("Print").Select
Cells.Select
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = xlAutomatic
End With
View 9 Replies
View Related
Apr 15, 2009
I am receiving the error:
Run-time error 1004 Application-defined or object-defined error.
It is occuring on the line of
Selection.QueryTable.Refresh BackgroundQuery:=False.
I am using SQL '05, Excel '03, and VB 6.3. I am trying to run a SQL stored procedure into Excel. So far all of my VB code seems to be running fine.
View 9 Replies
View Related