400 Error Vb Excel
Contents |
Tech Support Guy, we highly recommend that you visit our Guide for New Members. Solved: VBA error "400" running an Excel macro. Discussion in 'Business Applications' started by exerguy, excel vba error 1004 Dec 2, 2008. Thread Status: Not open for further replies. Advertisement exerguy Thread error 400 vba excel 2010 Starter Joined: Nov 10, 2008 Messages: 21 I have created a macro that goes through my workbook and is supposed to
Vba Error 400 Excel 2013
clear the interior color from cells A1:I900 on each page. When I try to run the macro I get a pop up that just says "400" in it with a red circle that has a
Error Code 400 Excel Macro
white "X" through it. Here is the code: Sub Clearcolors() Dim ws As Worksheet Dim RngH As Range Dim RngHD As Range For Each ws In ThisWorkbook.Worksheets ws.Select Set RngH = ws.Range("A1:I" & Range("I900").End(xlUp).Row) For Each RngHD In RngH RngHD.Interior.ColorIndex = xlNone Next RngHD Next ws End Sub What can I do to fix this problem? Any suggestions? exerguy, Dec 2, 2008 #1 Sponsor OBP Trusted Advisor Joined: excel vba label not defined Mar 8, 2005 Messages: 19,065 The first thing you need to do is to add an Error trap to find out what the Error description is, (if it can tell you that is) Add this as the first row of code after the "Dim RngHD As Range" On Error GoTo Errorcatch and at the end of the code put exit sub Errorcatch: MsgBox Err.Description OBP, Dec 2, 2008 #2 exerguy Thread Starter Joined: Nov 10, 2008 Messages: 21 Okay. I added the error catch and the error I get is: "Method 'Select' of object '_worksheet' failed." I'm not too sure where to go from here. Any suggestions? exerguy, Dec 2, 2008 #3 bomb #21 Joined: Jul 1, 2005 Messages: 8,284 Suggestion 1: check for hidden sheets; you'll have a job trying to select those. Suggestion 2: explain what the purpose of the code is, since it doesn't seem to work even with ws.Select suppressed. bomb #21, Dec 3, 2008 #4 exerguy Thread Starter Joined: Nov 10, 2008 Messages: 21 I do have one hidden sheet. Unhiding it allows the macro to work, but is there a way to do this without unhiding it? exerguy, Dec 3, 2008 #5 bomb #21 Joined: Jul 1
Forums Excel Questions Visual Basic error: 400 Results 1 to 2 of 2 Visual Basic error: 400This is a discussion on Visual Basic error: 400 within the Excel Questions forums, part of the Question Forums category; Hi I have a macro which had been working fine,
Vba Error Catch
which had the following code: With Range("Contact") .Locked = False ... LinkBack LinkBack URL About LinkBacks vba error 400 protected sheet Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode microsoft visual basic for applications error 400 excel 2013 Switch to Threaded Mode Jul 15th, 2010,05:32 PM #1 peejay Board Regular Join Date Jul 2003 Location Sydney Posts 53 Visual Basic error: 400 Hi I have a macro which had been working fine, which had the following code: With Range("Contact") https://forums.techguy.org/threads/solved-vba-error-400-running-an-excel-macro.775340/ .Locked = False .Copy .PasteSpecial Paste:=xlPasteValues .Interior.ColorIndex = 36 End With where the range "Contact" is on the active sheet, and the active sheet is unprotected. For some reason, the macro started throwing up an error box, titled 'Microsoft Visual Basic', showing only '400' (with OK & Help buttons). I've fixed the problem, changing the 1st two lines to the following: Range("Contact").Select With Selection but, I'd be interested in understanding why this has occurred. Thanks, PJ Share Share this post on Digg http://www.mrexcel.com/forum/excel-questions/481544-visual-basic-error-400-a.html Del.icio.us Technorati Twitter cheers, PJ Reply With Quote Jul 16th, 2010,02:11 PM #2 xenou MrExcel MVPModerator Join Date Mar 2007 Location Clev. OH, USA Posts 14,826 Re: Visual Basic error: 400 400 errors are, by definition, unspecified and (for all intents and purposes) mysterious. Your code should not fail here, as far as I can tell. You may even find that changing it back, it will now work again. The only way I know of to troubleshoot 400 errors is to step through the code line by line - and watch for the moment when it crashes. From on outside perspective, the fact that you are unlocking a cell in order to do something with it suggests that there's an issue with worksheet protection. You say the sheet is unprotected - but if so, why must the cell be unlocked? I suspect there are other factors at play - though I can't say what or how, or why your code fix has made a difference. Another try, without selection, might be: Code: Dim r As Range Set r = Range("Contacts") With r '// code End With I'm sure this is unsatisfactory as a response. If you're still interested in why, then give more details - what's this about with unlocking the cell, what's in the range and what's the purpose of the code? Is it in a larger procedure and if so what else is going on? Is the sheet being used with protection, and how?
soon) Ruby (coming soon) Getting Started Code Samples Resources Patterns and Practices App Registration Tool Events Podcasts Training API Sandbox Videos Documentation Office Add-ins Office Add-in https://social.msdn.microsoft.com/Forums/office/en-US/69f3c0da-43ec-4760-abef-58155fd3ebfb/vba-macro-execution-fails-with-error-400?forum=exceldev Availability Office Add-ins Changelog Microsoft Graph API Office 365 Connectors Office 365 http://www.techsupportforum.com/forums/f57/vba-error-400-a-443325.html REST APIs SharePoint Add-ins Office UI Fabric Submit to the Office Store All Documentation https://www.yammer.com/ http://feeds.feedburner.com/office/fmNx Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: VBA: Macro execution fails with Error 400 Microsoft Office for Developers > vba error Excel for Developers Question 0 Sign in to vote Excel Version: 2010 Business Pro Problem: I have a macro that is getting to a certain line of code then encountering an Error 400 ("Form Already Displayed; Can't Show Modally"; don't really understand what this error is). I am including the code for the macro below.You will note in the code below, vba error 400 where the macro bombs out. I didn't bother including code for any of the othercalled macros since they don't seem to be the problem. Any suggestions would be welcome. The Msgboxes are for debugging only. Regards, ...bob sutor PageBreaksRows_Button MACRO CODE: Public Sub PageBreakRows_Button() 'On Error GoTo ErrorHandler1: 'TURN OFF FEATURES TO SPEED UP MACRO PROCESSING: If c = 0 Then _ PerformanceOptionsOFF 'SETACTIVE SHEETNAME Dim strPageBreaksSheetName As String Dim strReferenceSheetName As String Dim intErrorCount As Integer strPageBreaksSheetName = ActiveSheet.Name strReferenceSheetName = "5005-PageBreaks" vrZoom = 75 intPaperSize = 1 ' 1 = Letter, 17 = 11x17 intOrientation = 1 ' 1= Portrait, 2 = Landscape 'SET SOURCE SHEET STATUS blnSourceSheetVisibleStatus = ActiveSheet.Visible ActiveSheet.Visible = True blnSourceSheetProtectStatus = ActiveSheet.ProtectContents ActiveSheet.Unprotect Password:=strPassword 100 Answer = MsgBox("Do you want to proceed with resetting all page breaks on active sheet?", vbOKCancel) Select Case Answer Case vbOK strPageBreaksAddRemove = "Add" ActiveSheet.ResetAllPageBreaks 'Reset print parameters after page breaks reset Sheets(strPageBreaks
98 & ME Support Windows Servers Microsoft Office Support Internet Browsers and Email Internet Explorer & Edge Forum Mozilla / Firefox Browsers Other Browsers Email Alternative Computing Linux Support Mac Support Other Operating Systems Hardware Support Overclocking Motherboards, Bios & CPU Hard Drive Support Removable Media Drives RAM & Power Supply Sound Cards Case Mod Driver Support Video Card Support Printer Support Laptop Support Building Other Hardware Support Networking Forum Networking Support Modems / Cable / DSL / Satellite Cabling & Network Cards Protocols & Routing File & Application Sharing Security & Firewalls The IT Pro Certification & Career Programming Gaming Forum PC Gaming Support Game Installation Support Console Gaming Support Online/Network Gaming Support Mods & Maps Gaming Discussion Design Forum Web Design & Dev Graphic Design/Multimedia Web Serving & Management Design Discussion & FAQ Website Design Counsel Smart Devices Apple iOS Android OS Blackberry/RIM OS Palm WebOS Windows Mobile Other Mobile Tech Support Articles Apple Certification Gaming General Hardware Internet Linux Networking Photography Security Software Tips & Tricks Windows Spyware 1st Steps Rules Tech Support Forum > Microsoft Support > Microsoft Office support VBA Error 400 User Name Remember Me? Password Site Map Posting Help Register Rules Today's Posts Search Site Map Home Forum Rules Members List Contact Us Community Links Pictures & Albums Members List Search Forums Show Threads Show Posts Tag Search Advanced Search Search Site / Google View Posts New Posts Your Posts Go to Page... VBA Error 400 This is a discussion on VBA Error 400 within the Microsoft Office support forums, part of the Tech Support Forum category. I am using VBA for Excel. I keep getting error 400 pop up in a message box. Doesn't happen all Thread Tools Search this Thread 12-20-2009, 04:39 PM #1 Spoondigger Registered Member Join Date: Dec 2009 Posts: 2 OS: Vista I am using VBA for Excel. I keep getting error 400 pop up in a message box. Doesn't happen all of the time. I can't make it happen if its not happening. I can't stop it from happening once it happens. I seems almost arbitrary as to when it appears. What is error 400? What do I have to do to prevent error 400 from coming up? Robert NicholasBecea at hotmail dot com Remove Advertisements Sponsored Links TechSupportForum.com Advertisement 12-21-2009, 03:12 AM #2 macropod Moderator - Microsoft Support Microsoft MVP Join Date: Apr 2008 Location: Australia Posts: 2,345 OS: Win 7 (64-bit) Hi Robert, To track t