the first time font.bold is set to true, it completes w/o error. The bolded line returns 'application defined or object defined error 1004'. Ive tried activating the new sheet immediately before setting bold (like the first time it gets set) but it still errors.
I have problems with setting Validation input title and message. When in column "C" I type product code, data validation of corresponding cell in column "D" changes to list of diameters allowed for that product. That works fine. But i also want to set validation message to show allowed diameters.I set it in VBA using named ranges. But for every second line (13, 15, etc on attached file) I get an application-defined or object-defined error. The rest (14, 16 etc) works ok.
I have a very strange problem in DEBUG mode, because i get this error "Application-defined or object-defined error" when referring to a cell and assigning it a value so it goes to my error handler and i have a Resume Next there. It continues to go through the code whilst continuing to go to the error handler but when i step out of the function it restarts again from the beginning on the called function and then on the second run of my code it seems to WORK!?! So i'm thinking what the hell is going on, it falls over and fails the first time round and works the second time round? In free-run mode from excel i just get a #VALUE!
I am having some trouble with a variable range selection within a regression. I keep getting an "application-defined or object-defined error." I've isolated each statement to find that the code that is causing the regression not to work is below (the error for that line of code states that the Select method of Range class failed):
I'm trying to enter a series of formulas into a worksheet using vba. However, this code is giving me Run time error '1004', along with the description in the title. This is the first formula (they're all relatively similar).
I am having difficulty getting a form to work the way that I would like it to work. I have a form that is used to display questions that my students will be answering. The form also is used to put the answers into a worksheet. I have 2 sheets. Sheet2 has the questions, student answers, and correct answers. Sheet1 is used to indicate correct answers and to keep track of percentage correct. I am fairly new to VB. I have 2 pieces of code that I am going to post. The first one works and the second one doesn't.
This is in the "This Workbook" section and it works. Option Explicit Public intNoQ As Integer Public strNoQ As String Public NumberofQuestions As Integer Dim StudentName As String Dim InputBoxAnswer As String Public Sub Workbook_Open() Application.Visible = False 'Hide Excel Load Questions Load NumberCorrect NumberofQuestions = Worksheets("Sheet1").Range("K3").Value For intNoQ = 1 To NumberofQuestions strNoQ = VBA.CStr(intNoQ) If intNoQ = 1 Then Questions.Controls("QuestionNumberBox").Value = "Question#" & strNoQ Questions.Controls("QuestionBox").Value = Worksheets("Sheet2").Range("B1").Value End If Questions.Controls("CorrectBox" & strNoQ).Visible = True Questions.Controls("CorrectLabel" & strNoQ).Visible = True Next intNoQ...............
I'm trying to figure out why I can run a bit of code on my machine but on another machine I get an: Application-defined or object-defined error. The code is in an excel file on a network drive and it pulls up a form, once the form is submitted it runs some code that looks like so
When opening a blank excel workbook I receive the error "1004 Application-defined or object-defined error". I press OK. And the message appears 2 more times before I am able to work in Excel. Doesn't matter what excel file I am opening, does the same thing. I do not know how to lookup programming code for any macros I am running. I would like to get rid of this error! It is a nusance.
I get "Application-defined or Object-defined error" , run-time error 1004.
Option Explicit Sub Initialize() Dim rList As String Dim CountRows, CurrCol As Integer rList = "myTemplate" Range("A2").Select CountRows = Range(Selection, Selection.End(xlDown)).Rows.Count
CurrCol = 7 With Range("G : G" & CountRows + 1) With .Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=" & rList .ErrorTitle = "JC Message" .InputMessage = "Select requested template" .ErrorMessage = "You must enter a template from a list only" .IgnoreBlank = False End With End With End Sub
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.
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
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
Basically this is code that will find the last column in a specified row with text. It will then add a comment to the next column space that does not have any text.
I'm working on a spending diary project in excel, and have hit a problem in a macro, runtime error 1004, Application defined or object defined error. The debugger indicates the line
I have been getting this error with the following code.
Sub MyPrintout() Dim NumPages As Integer Dim LastRow As Integer
For MyNum = 3 To 11 Step 1 Sheets(MyNum).Activate
With ActiveSheet LastRow = .Cells(.Rows.Count, "L").End(xlUp).Row + 3 End With
ActiveSheet.Range("A1:M" & LastRow).Select 'Either this line or the next line causes the error Selection.Sort Key1:=Range("H3"), Order1:=xlAscending, XLGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal
The section of the code that sorts the page runs in a macro by itself but will not run with this code. I think it is the way I am referring to the sheet but I cannot narrow it down.
I have a spreadsheet (excel 2003) with several pages with formulas and I want to protect them while allowing users to use filters, allow cell comments, increase column width etc. I recorded a macro and modified it a bit to input a password and to use a shortcut because I don't want users to unprotect them from the menu. When run the short cut to protect the sheet, I get the error 'Run time error 1004' application defined or object defined error. When i click on debug, the following gets highlighted in yellow.