Excel Vba Run Time Error 91
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about excel vba runtime error 424 hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask
Excel Vba Runtime Error 91 Find
Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join
Excel 2010 Vba Runtime Error 91
them; it only takes a minute: Sign up VBA Run time error 91. Trouble setting object variable up vote 0 down vote favorite I don't think the answer is too complicated, I must just be missing something basic. To
Excel Vba Runtime Error 91 Object Variable
give context, the code and this macro were written by an employee who was no longer working here when I started. I have just used it a number of times on a monthly basis and it suddenly gave me an error today when I attempted to run the VBA script. It gives me the standard Run Time Error 91 (Object variable or block variable not set). The code specifically is: Dim DataBook As Workbook Set DataBook = Workbooks.Open(Import_File_Path) run time error 91 in excel DataBook.Worksheets("Sheet1").Name = "Database" Application.DisplayAlerts = False Tool.Worksheets("Database").Delete <-----highlighted error line Application.DisplayAlerts = True DataBook.Worksheets("Database").Move before:=Tool.Worksheets(1) The VBA script is attempting to take raw data from an Excel sheet that I have already generated, and import the file (thus that part in the Set line) and perform a number of calculations to create more data and stats from there. However the problem I feel lies in the section I posted here and the objects and variables. The highlighted error row is the one that says Tool.Worksheets("Database").Delete. When I added a Watch to that row the value states Object Variable or With block variable not set. This leads me to believe something is not being set as it should as an object, but again I am a VBA newbie and I am not confident about any of my gut feelings. For what its worth, I should mention I added another Watch to the line that says DataBook.Worksheets("Sheet1").Name = "Database" and the value for that states Subscript out of range. I thought that meant it could also be a problem, however I am 100% sure there is a tab in the file I am importing that is named Sheet1. excel vba excel-vba runtime-error share|improve this question edited Aug 6 '15 at 10:08 Luuklag 1,231928 asked Apr 3 '14 at 14:06 user3494029 3112 1 What is Tool ... what kind of object it is? –Pankaj Jaju Ap
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums vba run-time error '91' Blogs Channel 9 Documentation APIs and reference Dev centers Retired content excel vba runtime error 438 Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. excel vba runtime error 9 subscript out of range Reference Trappable Errors Core Visual Basic Language Errors Core Visual Basic Language Errors 91 Object variable or With block variable not set 91 Object variable or With block http://stackoverflow.com/questions/22840227/vba-run-time-error-91-trouble-setting-object-variable variable not set 91 Object variable or With block variable not set 3 Return without GoSub 5 Invalid procedure call or argument 6 Overflow 7 Out of memory 9 Subscript out of range 10 This array is fixed or temporarily locked 11 Division by zero 13 Type mismatch 14 Out of string space 16 Expression https://msdn.microsoft.com/en-us/library/aa264506(v=vs.60).aspx too complex 17 Can't perform requested operation 18 User interrupt occurred 20 Resume without error 28 Out of stack space 35 Sub, Function, or Property not defined 47 Too many DLL application clients 48 Error in loading DLL 49 Bad DLL calling convention 51 Internal error 52 Bad file name or number 53 Can't find specified file 54 Bad file mode 55 File already open 57 Device I\O error 58 File already exists 59 Bad record length 61 Disk full 62 Input past end of file 63 Bad record number 67 Too many files 68 Device unavailable 70 Permission denied 71 Disk not ready 74 Can't rename with different drive 75 Path\File access error 76 Path not found 91 Object variable or With block variable not set 92 For loop not initialized 93 Invalid pattern string 94 Invalid use of Null 96 Can't sink this object's events because it's already firing events... 97 Can't call Friend procedure on an object that isn't an instance of...
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job https://www.experts-exchange.com/questions/28635697/run-time-error-91-Object-Variable-or-With-Block-not-set-EXCEL-VBA.html Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website time error Testing Store Headlines Experts Exchange > Questions > run-time error 91 Object Variable or With Block not set. .... EXCEL VBA Want to Advertise Here? Solved run-time error 91 Object Variable or With Block not set. .... EXCEL VBA Posted on 2015-03-13 MS Excel VBA excel vba run 3 Verified Solutions 20 Comments 1,244 Views Last Modified: 2016-02-11 This workbook opens up another and updates it - Keep getting the error shown below with this line highlighted - but not in every sheet it hits - they are random and it will change Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False Here is the code Sub Auto_Open() ' ' Auto_Open Macro ' Macro updated 2/11/15 by Helen Billingham ' 'Open Daily Tracking.xlsm and refresh all active tabs Workbooks.Open ("V:\DPMTS\MATCON\PP&DProjectTeam\TrackingReport\Daily Tracking.xlsm") Sheets("TwizzlerBonus").Select Range("J2").Select ActiveSheet.Unprotect Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False Range("J2").Select Sheets("BonusPckgCandy").Select Range("J2").Select ActiveSheet.Unprotect Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False Range("J2").Select Sheets("Halloween").Select Range("J2").Select ActiveSheet.Unprotect Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False Range("J2").Select Sheets("CanadianHalloween").Select Range("J2").Select ActiveSheet.Unprotect Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False Range("J2").Select Sheets("Holiday").Select Range("J2").