Cannot Run Visual Basic Macro Because Of A Syntax Error
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 hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask 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 them; it only takes a minute: Sign up Cannot Run Visual Basic Editor Because of a Syntax error whilst recording macro up vote 2 down vote favorite 1 I am a bit suprised as I am trying to record a macro in Excel, but I keep getting this error: Cannot Run Visual Basic Editor Because of a Syntax error The most surprising part is that I am not trying to run any macro yet, just trying to record it. The first time I noticed this I tried to record something like vlookup(Today(),Sheet2!A1:B2,2) Initially I assumed it was an error in the formula I typed, but then I noticed that the correct value was displayed in the sheet. Now I have a module that looks like this, and each time I try to record something the error pops up. Option Explicit Sub Macro34() ActiveCell.FormulaR1C1 = "=TODAY()" End Sub Sub Macro35() ActiveCell.FormulaR1C1 = "=5" End Sub I have written some other macro code in other modules, but that is not supposed to run at the moment (and I didn't see any errors in it as well). I have searched for this error but each found result is about someone trying to run a macro. It is really annoying me so I hope someone can tell me how to get rid of this error. excel vba excel-vba syntax-error share|improve this question edited Feb 24 '15 at 0:54 pnuts 33.7k63569 asked Dec 10 '13 at 16:57 Dennis Jaheruddin 14.1k32465 2 1) what version of Excel? 2) do you have any excel add-ins, VBA tools, etc. loaded? –RBarryYoung Dec 10 '13 at 17:07 1 That is a very erratic behaviour. May I see your excel file? –Siddharth Rout Dec 10 '13 at 17:07 Have you tried compiling in the editor? Where does that take you? –nutsch Dec 10 '13 at 17:09 add a comment| 2 An
Forums Excel Questions Run time error 1004 - Can't run VB macro cos of syntax error Page 1 of 2 12 Last Jump to page: Results 1 to 10 of 12 Run time error 1004 - Can't run VB macro cos of syntax errorThis is a discussion on Run time error 1004 - Can't run VB macro cos of syntax error within the Excel Questions forums, part of the Question Forums category; All I am new to the msg board and I am about to toss the monitor out the window! I ... LinkBack LinkBack URL About http://stackoverflow.com/questions/20500538/cannot-run-visual-basic-editor-because-of-a-syntax-error-whilst-recording-macro LinkBacks 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 Switch to Threaded Mode Aug 9th, 2004,09:31 AM #1 goose77 New Member Join Date Aug 2004 Posts 6 Run time error 1004 - Can't run VB macro cos of syntax error All I am new to the msg board and http://www.mrexcel.com/forum/excel-questions/97146-run-time-error-1004-cant-run-vbulletin-macro-cos-syntax-error.html I am about to toss the monitor out the window! I have a macro which loops thru a list of cost centres in one workbook, copies each cost centre to a template workbook ("causal tracksv2) and then refreshes the workbook twice (this is because we use an Excel add in, the data cube TM1, which must sometimes send on first refresh and then receive data on second refresh). When the code gets to the first refresh, the run time error in the subject of this posting occurs. When I hit debug and then carry on as normal without changing anything, the macro continues running as it should. The run time error happens every time there is a new cost centre, and there are alot of them! The offending code seems to be the 2nd last line in: While Cells(i, 1) <> "" CC = Cells(i, 1) Workbooks("causal tracksv2").Activate Cells(1, 1).Select ActiveCell.FormulaR1C1 = CC Workbooks.Application.Calculate Workbooks.Application.Calculate Any help would be appreciated! Thanks! Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Aug 9th, 2004,09:37 AM #2 TommyGun MrExcel MVP Join Date Dec 2002 Location Clear Lake, TX Posts 4,202 Re: Run time error 1004 - Can't
Cannot run Visual Basic macro because of a syntax error I have 280,000 rows with 36 columns. I'm looking to pair down the file. I would like to reduce the file so that there are no more than http://www.excelarticles.com/Excel_Run-time_error_'1004'_Cannot_run_Visual_Basic.html 10 rows per company (column H). Some companies have 3 rows, some have 5000. I would like the macro to return a sheet with up to, but no more than 10 rows per company along with all of columns associated with their row. There are 5 sheets on my file. The sheet I'm trying to reduce is titled "All comp", the blank sheet where I want to the results to go titled "new data". I am cannot run trying to use the below macro, but I'm getting the error: Run-time error '1004': Cannot run Visual Basic macro because of a syntax error It highlights .calculate as the first step in what is wrong with what I've entered. Code: Sub TenDuplicates() With Application .ScreenUpdating = False .Calculate .Calculation = xlCalculationManual .DisplayAlerts = False .EnableEvents = False End With Dim raw As Worksheet Dim output As Worksheet Dim names() As String This question generated 16 cannot run visual answers. To proceed to the answers, click here. This thread is current as of October 1, 2014.For more resources for Microsoft Excel: Excel VBA Book Ctrl+Shift+Enter Array Formulas Learn Excel from MrExcel This article includes the following tags: Excel Microsoft Excel MrExcel.com & related websites debuted on November 21, 1998. ExcelArticles.com provides examples of Formulas, Functions and Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Formulas, Functions and Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations. This site contains affiliate links. Any affiliate commissions that we earn when you click a link to Amazon or other sites is reinvested in keeping MrExcel.com and ExcelArticles.com running. You can earn a commission for sales leads that you send to us by joining our affiliate program. View my Privacy Policy. Excel ® is a registered trademark of the Microsoft Corporation. MrExcel ® is a registered trademark of Tickling Keys, Inc. All contents © 1998-2014 by MrExcel Consulting | All rights reserved Popular Pages Home More Info Spread the Word Excel Tweet Search Navigation HomeExcel VideosHot TopicsBook ExcerptMrExcel SeminarsMessage BoardTop Menu Social Twitter Facebook Google+ © excelarticles.com. All rights reserved. Privacy Policy