Vba run time error 40036

Vba run time error 40036 This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions. Asked by: Question I am getting this Run time error 40036 when trying to unlock my worksheet. Works fine on another computer with same excel 365 version. Using latest 1807 version. Only happen through vba, […]

Содержание

  1. Vba run time error 40036
  2. Asked by:
  3. Question
  4. All replies
  5. Как исправить ошибку Microsoft Excel 40036
  6. Основы «Excel Error 40036»
  7. Что вызывает ошибку времени выполнения 40036?
  8. Типичные ошибки Excel Error 40036
  9. Причины проблем Excel Error 40036
  10. Vba run time error 40036
  11. Asked by:
  12. Question
  13. All replies
  14. Vba run time error 40036
  15. Спрашивающий
  16. Вопрос
  17. Все ответы
  18. Vba run time error 40036
  19. Asked by:
  20. Question
  21. All replies

Vba run time error 40036

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Asked by:

Question

I am getting this Run time error 40036 when trying to unlock my worksheet. Works fine on another computer with same excel 365 version. Using latest 1807 version. Only happen through vba, if i manually unlock it with password, it works fine.

Here is my code to unlock:

I’ve tried different other way to unlock and it still throwing error.

  • Edited by vkid12 Thursday, July 26, 2018 3:06 PM
  • Moved by Winnie Liang Microsoft contingent staff Friday, July 27, 2018 5:58 AM

Based on your description, I know that you are getting the VBA runtime error issue. To better resolve the issue, I will move it to Excel for Developers forum.

Thanks for your understandings!

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

What kind of project did you build? To unprotect a worksheet in document-level customization,you could try the code below:

To unprotect a worksheet in a VSTO add-in,you could try the code below:

Expect the error code, what’s the error message? Does the issue occur on every workbook or only on specific workbook? What’s the building number of your office?

Источник

Как исправить ошибку Microsoft Excel 40036

Номер ошибки: Ошибка 40036
Название ошибки: Excel Error 40036
Описание ошибки: Ошибка 40036: Возникла ошибка в приложении Microsoft Excel. Приложение будет закрыто. Приносим извинения за неудобства.
Разработчик: Microsoft Corporation
Программное обеспечение: Microsoft Excel
Относится к: Windows XP, Vista, 7, 8, 10, 11

Основы «Excel Error 40036»

Люди часто предпочитают ссылаться на «Excel Error 40036» как на «ошибку времени выполнения», также известную как программная ошибка. Разработчики тратят много времени и усилий на написание кода, чтобы убедиться, что Microsoft Excel стабилен до продажи продукта. К сожалению, некоторые критические проблемы, такие как ошибка 40036, часто могут быть упущены из виду.

После установки программного обеспечения может появиться сообщение об ошибке «Excel Error 40036». Когда это происходит, конечные пользователи программного обеспечения могут сообщить Microsoft Corporation о существовании ошибки 40036 ошибок. Команда программирования может использовать эту информацию для поиска и устранения проблемы (разработка обновления). Таким образом при выполнении обновления программного обеспечения Microsoft Excel, он будет содержать исправление для устранения проблем, таких как ошибка 40036.

Что вызывает ошибку времени выполнения 40036?

Ошибки выполнения при запуске Microsoft Excel — это когда вы, скорее всего, столкнетесь с «Excel Error 40036». Три распространенные причины, по которым ошибки во время выполнения, такие как всплывающее окно ошибки 40036:

Ошибка 40036 Crash — ошибка 40036 блокирует любой вход, и это может привести к сбою машины. Это происходит много, когда продукт (Microsoft Excel) или компьютер не может обрабатывать уникальные входные данные.

«Excel Error 40036» Утечка памяти — Ошибка 40036 утечка памяти происходит и предоставляет Microsoft Excel в качестве виновника, перетаскивая производительность вашего ПК. Есть некоторые потенциальные проблемы, которые могут быть причиной получения проблем во время выполнения, с неправильным кодированием, приводящим к бесконечным циклам.

Ошибка 40036 Logic Error — Вы можете столкнуться с логической ошибкой, когда программа дает неправильные результаты, даже если пользователь указывает правильное значение. Это видно, когда исходный код Microsoft Corporation содержит недостаток в обработке данных.

Excel Error 40036 проблемы часто являются результатом отсутствия, удаления или случайного перемещения файла из исходного места установки Microsoft Excel. Для устранения неполадок, связанных с файлом Microsoft Corporation, большинство профессионалов ПК заменят файл на соответствующую версию. Если ошибка Excel Error 40036 возникла в результате его удаления по причине заражения вредоносным ПО, мы рекомендуем запустить сканирование реестра, чтобы очистить все недействительные ссылки на пути к файлам, созданные вредоносной программой.

Типичные ошибки Excel Error 40036

Усложнения Microsoft Excel с Excel Error 40036 состоят из:

  • «Ошибка приложения Excel Error 40036.»
  • «Недопустимая программа Win32: Excel Error 40036»
  • «Извините за неудобства — Excel Error 40036 имеет проблему. «
  • «К сожалению, мы не можем найти Excel Error 40036. «
  • «Отсутствует файл Excel Error 40036.»
  • «Ошибка запуска программы: Excel Error 40036.»
  • «Excel Error 40036 не выполняется. «
  • «Ошибка Excel Error 40036. «
  • «Excel Error 40036: путь приложения является ошибкой. «

Проблемы Microsoft Excel Excel Error 40036 возникают при установке, во время работы программного обеспечения, связанного с Excel Error 40036, во время завершения работы или запуска или менее вероятно во время обновления операционной системы. Важно отметить, когда возникают проблемы Excel Error 40036, так как это помогает устранять проблемы Microsoft Excel (и сообщать в Microsoft Corporation).

Причины проблем Excel Error 40036

Заражение вредоносными программами, недопустимые записи реестра Microsoft Excel или отсутствующие или поврежденные файлы Excel Error 40036 могут создать эти ошибки Excel Error 40036.

В частности, проблемы Excel Error 40036 возникают через:

  • Недопустимые разделы реестра Excel Error 40036/повреждены.
  • Вирус или вредоносное ПО, повреждающее Excel Error 40036.
  • Excel Error 40036 злонамеренно или ошибочно удален другим программным обеспечением (кроме Microsoft Excel).
  • Другая программа находится в конфликте с Microsoft Excel и его общими файлами ссылок.
  • Неполный или поврежденный Microsoft Excel (Excel Error 40036) из загрузки или установки.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Источник

Vba run time error 40036

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Asked by:

Question

I am getting this Run time error 40036 when trying to unlock my worksheet. Works fine on another computer with same excel 365 version. Using latest 1807 version. Only happen through vba, if i manually unlock it with password, it works fine.

Here is my code to unlock:

I’ve tried different other way to unlock and it still throwing error.

  • Edited by vkid12 Thursday, July 26, 2018 3:06 PM
  • Moved by Winnie Liang Microsoft contingent staff Friday, July 27, 2018 5:58 AM

Based on your description, I know that you are getting the VBA runtime error issue. To better resolve the issue, I will move it to Excel for Developers forum.

Thanks for your understandings!

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

What kind of project did you build? To unprotect a worksheet in document-level customization,you could try the code below:

To unprotect a worksheet in a VSTO add-in,you could try the code below:

Expect the error code, what’s the error message? Does the issue occur on every workbook or only on specific workbook? What’s the building number of your office?

Источник

Vba run time error 40036

Спрашивающий

Вопрос

I am getting this Run time error 40036 when trying to unlock my worksheet. Works fine on another computer with same excel 365 version. Using latest 1807 version. Only happen through vba, if i manually unlock it with password, it works fine.

Here is my code to unlock:

I’ve tried different other way to unlock and it still throwing error.

Все ответы

Based on your description, I know that you are getting the VBA runtime error issue. To better resolve the issue, I will move it to Excel for Developers forum.

Thanks for your understandings!

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

What kind of project did you build? To unprotect a worksheet in document-level customization,you could try the code below:

To unprotect a worksheet in a VSTO add-in,you could try the code below:

Expect the error code, what’s the error message? Does the issue occur on every workbook or only on specific workbook? What’s the building number of your office?

Источник

Vba run time error 40036

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Asked by:

Question

I have a worksheet that has suddenly become inaccessible through VB code:

This line throws the error:

I can select the sheet manually.

I f I record a macro, selecting the sheet as the only step in the macro, and then run the macro. same error

If I attempt to enumerate the worksheet collection by any method, code name, collection item number. same error.

Error 40036 is a particularly unhelpful error, considering, the worksheet is a core excel object.

Do you have any VBA code in the Worksheet’s module? If so, open that module and ensure that you have Option Explicit as the very first VBA line of code before any subs and then select menu item Debug -> Compile. If it returns any errors then fix.

If compile does not return any errors then do you have a worksheet Activate event for the worksheet? If so, rename the Activate sub (Just add an underscore and any character at the end of the sub name) and then test. If you can then select then look for an error in the Activate event.

If above does not work then copy all of the code in the worksheet’s module and paste into Notebook and save as a text file as backup. Then delete all the code from the module and test again. Again if this fixes then you will need to identify the code problem in the worksheet’s module.

Also if you have Worksheet Activate code in ThisWorkbook module then need to perform similar tests.

Источник

Icon Ex Номер ошибки: Ошибка 40036
Название ошибки: Excel Error 40036
Описание ошибки: Ошибка 40036: Возникла ошибка в приложении Microsoft Excel. Приложение будет закрыто. Приносим извинения за неудобства.
Разработчик: Microsoft Corporation
Программное обеспечение: Microsoft Excel
Относится к: Windows XP, Vista, 7, 8, 10, 11

Основы «Excel Error 40036»

Люди часто предпочитают ссылаться на «Excel Error 40036» как на «ошибку времени выполнения», также известную как программная ошибка. Разработчики тратят много времени и усилий на написание кода, чтобы убедиться, что Microsoft Excel стабилен до продажи продукта. К сожалению, некоторые критические проблемы, такие как ошибка 40036, часто могут быть упущены из виду.

После установки программного обеспечения может появиться сообщение об ошибке «Excel Error 40036». Когда это происходит, конечные пользователи программного обеспечения могут сообщить Microsoft Corporation о существовании ошибки 40036 ошибок. Команда программирования может использовать эту информацию для поиска и устранения проблемы (разработка обновления). Таким образом при выполнении обновления программного обеспечения Microsoft Excel, он будет содержать исправление для устранения проблем, таких как ошибка 40036.

Что вызывает ошибку времени выполнения 40036?

Ошибки выполнения при запуске Microsoft Excel — это когда вы, скорее всего, столкнетесь с «Excel Error 40036». Три распространенные причины, по которым ошибки во время выполнения, такие как всплывающее окно ошибки 40036:

Ошибка 40036 Crash — ошибка 40036 блокирует любой вход, и это может привести к сбою машины. Это происходит много, когда продукт (Microsoft Excel) или компьютер не может обрабатывать уникальные входные данные.

«Excel Error 40036» Утечка памяти — Ошибка 40036 утечка памяти происходит и предоставляет Microsoft Excel в качестве виновника, перетаскивая производительность вашего ПК. Есть некоторые потенциальные проблемы, которые могут быть причиной получения проблем во время выполнения, с неправильным кодированием, приводящим к бесконечным циклам.

Ошибка 40036 Logic Error — Вы можете столкнуться с логической ошибкой, когда программа дает неправильные результаты, даже если пользователь указывает правильное значение. Это видно, когда исходный код Microsoft Corporation содержит недостаток в обработке данных.

Excel Error 40036 проблемы часто являются результатом отсутствия, удаления или случайного перемещения файла из исходного места установки Microsoft Excel. Для устранения неполадок, связанных с файлом Microsoft Corporation, большинство профессионалов ПК заменят файл на соответствующую версию. Если ошибка Excel Error 40036 возникла в результате его удаления по причине заражения вредоносным ПО, мы рекомендуем запустить сканирование реестра, чтобы очистить все недействительные ссылки на пути к файлам, созданные вредоносной программой.

Типичные ошибки Excel Error 40036

Усложнения Microsoft Excel с Excel Error 40036 состоят из:

  • «Ошибка приложения Excel Error 40036.»
  • «Недопустимая программа Win32: Excel Error 40036»
  • «Извините за неудобства — Excel Error 40036 имеет проблему. «
  • «К сожалению, мы не можем найти Excel Error 40036. «
  • «Отсутствует файл Excel Error 40036.»
  • «Ошибка запуска программы: Excel Error 40036.»
  • «Excel Error 40036 не выполняется. «
  • «Ошибка Excel Error 40036. «
  • «Excel Error 40036: путь приложения является ошибкой. «

Проблемы Microsoft Excel Excel Error 40036 возникают при установке, во время работы программного обеспечения, связанного с Excel Error 40036, во время завершения работы или запуска или менее вероятно во время обновления операционной системы. Важно отметить, когда возникают проблемы Excel Error 40036, так как это помогает устранять проблемы Microsoft Excel (и сообщать в Microsoft Corporation).

Причины проблем Excel Error 40036

Заражение вредоносными программами, недопустимые записи реестра Microsoft Excel или отсутствующие или поврежденные файлы Excel Error 40036 могут создать эти ошибки Excel Error 40036.

В частности, проблемы Excel Error 40036 возникают через:

  • Недопустимые разделы реестра Excel Error 40036/повреждены.
  • Вирус или вредоносное ПО, повреждающее Excel Error 40036.
  • Excel Error 40036 злонамеренно или ошибочно удален другим программным обеспечением (кроме Microsoft Excel).
  • Другая программа находится в конфликте с Microsoft Excel и его общими файлами ссылок.
  • Неполный или поврежденный Microsoft Excel (Excel Error 40036) из загрузки или установки.

Продукт Solvusoft

Загрузка
WinThruster 2022 — Проверьте свой компьютер на наличие ошибок.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

How to fix the Runtime Code 40036 Excel Error 40036

This article features error number Code 40036, commonly known as Excel Error 40036 described as Error 40036: Microsoft Excel has encountered a problem and needs to close. We are sorry for the inconvenience.

About Runtime Code 40036

Runtime Code 40036 happens when Microsoft Excel fails or crashes whilst it’s running, hence its name. It doesn’t necessarily mean that the code was corrupt in some way, but just that it did not work during its run-time. This kind of error will appear as an annoying notification on your screen unless handled and corrected. Here are symptoms, causes and ways to troubleshoot the problem.

Definitions (Beta)

Here we list some definitions for the words contained in your error, in an attempt to help you understand your problem. This is a work in progress, so sometimes we might define the word incorrectly, so feel free to skip this section!

  • Excel — Only for questions on programming against Excel objects or files, or complex formula development

Symptoms of Code 40036 — Excel Error 40036

Runtime errors happen without warning. The error message can come up the screen anytime Microsoft Excel is run. In fact, the error message or some other dialogue box can come up again and again if not addressed early on.

There may be instances of files deletion or new files appearing. Though this symptom is largely due to virus infection, it can be attributed as a symptom for runtime error, as virus infection is one of the causes for runtime error. User may also experience a sudden drop in internet connection speed, yet again, this is not always the case.

Fix Excel Error 40036 (Error Code 40036)
(For illustrative purposes only)

Causes of Excel Error 40036 — Code 40036

During software design, programmers code anticipating the occurrence of errors. However, there are no perfect designs, as errors can be expected even with the best program design. Glitches can happen during runtime if a certain error is not experienced and addressed during design and testing.

Runtime errors are generally caused by incompatible programs running at the same time. It may also occur because of memory problem, a bad graphics driver or virus infection. Whatever the case may be, the problem must be resolved immediately to avoid further problems. Here are ways to remedy the error.

Repair Methods

Runtime errors may be annoying and persistent, but it is not totally hopeless, repairs are available. Here are ways to do it.

If a repair method works for you, please click the upvote button to the left of the answer, this will let other users know which repair method is currently working the best.

Please note: Neither ErrorVault.com nor it’s writers claim responsibility for the results of the actions taken from employing any of the repair methods listed on this page — you complete these steps at your own risk.

Method 1 — Close Conflicting Programs

When you get a runtime error, keep in mind that it is happening due to programs that are conflicting with each other. The first thing you can do to resolve the problem is to stop these conflicting programs.

  • Open Task Manager by clicking Ctrl-Alt-Del at the same time. This will let you see the list of programs currently running.
  • Go to the Processes tab and stop the programs one by one by highlighting each program and clicking the End Process buttom.
  • You will need to observe if the error message will reoccur each time you stop a process.
  • Once you get to identify which program is causing the error, you may go ahead with the next troubleshooting step, reinstalling the application.

Method 2 — Update / Reinstall Conflicting Programs

Using Control Panel

  • For Windows 7, click the Start Button, then click Control panel, then Uninstall a program
  • For Windows 8, click the Start Button, then scroll down and click More Settings, then click Control panel > Uninstall a program.
  • For Windows 10, just type Control Panel on the search box and click the result, then click Uninstall a program
  • Once inside Programs and Features, click the problem program and click Update or Uninstall.
  • If you chose to update, then you will just need to follow the prompt to complete the process, however if you chose to Uninstall, you will follow the prompt to uninstall and then re-download or use the application’s installation disk to reinstall the program.

Using Other Methods

  • For Windows 7, you may find the list of all installed programs when you click Start and scroll your mouse over the list that appear on the tab. You may see on that list utility for uninstalling the program. You may go ahead and uninstall using utilities available in this tab.
  • For Windows 10, you may click Start, then Settings, then choose Apps.
  • Scroll down to see the list of Apps and features installed in your computer.
  • Click the Program which is causing the runtime error, then you may choose to uninstall or click Advanced options to reset the application.

Method 3 — Update your Virus protection program or download and install the latest Windows Update

Virus infection causing runtime error on your computer must immediately be prevented, quarantined or deleted. Make sure you update your virus program and run a thorough scan of the computer or, run Windows update so you can get the latest virus definition and fix.

Method 4 — Re-install Runtime Libraries

You might be getting the error because of an update, like the MS Visual C++ package which might not be installed properly or completely. What you can do then is to uninstall the current package and install a fresh copy.

  • Uninstall the package by going to Programs and Features, find and highlight the Microsoft Visual C++ Redistributable Package.
  • Click Uninstall on top of the list, and when it is done, reboot your computer.
  • Download the latest redistributable package from Microsoft then install it.

Method 5 — Run Disk Cleanup

You might also be experiencing runtime error because of a very low free space on your computer.

  • You should consider backing up your files and freeing up space on your hard drive
  • You can also clear your cache and reboot your computer
  • You can also run Disk Cleanup, open your explorer window and right click your main directory (this is usually C: )
  • Click Properties and then click Disk Cleanup

Method 6 — Reinstall Your Graphics Driver

If the error is related to a bad graphics driver, then you may do the following:

  • Open your Device Manager, locate the graphics driver
  • Right click the video card driver then click uninstall, then restart your computer

Method 7 — IE related Runtime Error

If the error you are getting is related to the Internet Explorer, you may do the following:

  1. Reset your browser.
    • For Windows 7, you may click Start, go to Control Panel, then click Internet Options on the left side. Then you can click Advanced tab then click the Reset button.
    • For Windows 8 and 10, you may click search and type Internet Options, then go to Advanced tab and click Reset.
  2. Disable script debugging and error notifications.
    • On the same Internet Options window, you may go to Advanced tab and look for Disable script debugging
    • Put a check mark on the radio button
    • At the same time, uncheck the «Display a Notification about every Script Error» item and then click Apply and OK, then reboot your computer.

If these quick fixes do not work, you can always backup files and run repair reinstall on your computer. However, you can do that later when the solutions listed here did not do the job.

Other languages:

Wie beheben Fehler 40036 (Excel-Fehler 40036) — Fehler 40036: Microsoft Excel hat ein Problem festgestellt und muss geschlossen werden. Wir entschuldigen uns für die Unannehmlichkeiten.
Come fissare Errore 40036 (Errore di Excel 40036) — Errore 40036: Microsoft Excel ha riscontrato un problema e deve essere chiuso. Ci scusiamo per l’inconveniente.
Hoe maak je Fout 40036 (Excel-fout 40036) — Fout 40036: Microsoft Excel heeft een probleem ondervonden en moet worden afgesloten. Excuses voor het ongemak.
Comment réparer Erreur 40036 (Erreur Excel 40036) — Erreur 40036 : Microsoft Excel a rencontré un problème et doit se fermer. Nous sommes désolés du dérangement.
어떻게 고치는 지 오류 40036 (엑셀 오류 40036) — 오류 40036: Microsoft Excel에 문제가 발생해 닫아야 합니다. 불편을 끼쳐드려 죄송합니다.
Como corrigir o Erro 40036 (Erro Excel 40036) — Erro 40036: O Microsoft Excel encontrou um problema e precisa fechar. Lamentamos o inconveniente.
Hur man åtgärdar Fel 40036 (Excel-fel 40036) — Fel 40036: Microsoft Excel har stött på ett problem och måste avslutas. Vi är ledsna för besväret.
Как исправить Ошибка 40036 (Ошибка Excel 40036) — Ошибка 40036: Возникла ошибка в приложении Microsoft Excel. Приложение будет закрыто. Приносим свои извинения за неудобства.
Jak naprawić Błąd 40036 (Błąd programu Excel 40036) — Błąd 40036: Microsoft Excel napotkał problem i musi zostać zamknięty. Przepraszamy za niedogodności.
Cómo arreglar Error 40036 (Error de Excel 40036) — Error 40036: Microsoft Excel ha detectado un problema y debe cerrarse. Lamentamos las molestias.

The Author About The Author: Phil Hart has been a Microsoft Community Contributor since 2010. With a current point score over 100,000, they’ve contributed more than 3000 answers in the Microsoft Support forums and have created almost 200 new help articles in the Technet Wiki.

Follow Us: Facebook Youtube Twitter

Recommended Repair Tool:

This repair tool can fix common computer problems such as blue screens, crashes and freezes, missing DLL files, as well as repair malware/virus damage and more by replacing damaged and missing system files.

STEP 1:

Click Here to Download and install the Windows repair tool.

STEP 2:

Click on Start Scan and let it analyze your device.

STEP 3:

Click on Repair All to fix all of the issues it detected.

DOWNLOAD NOW

Compatibility

Requirements

1 Ghz CPU, 512 MB RAM, 40 GB HDD
This download offers unlimited scans of your Windows PC for free. Full system repairs start at $19.95.

Article ID: ACX04260EN

Applies To: Windows 10, Windows 8.1, Windows 7, Windows Vista, Windows XP, Windows 2000

Speed Up Tip #92

Consider Using Windows Defender:

Windows Defender is a robust anti-virus software built right within the Windows platform. And, it is mostly good enough to protect your PC from getting infected. Just make sure to install an anti-malware tool on top of Windows Defender. Given that, it is best to uninstall any third-party anti-virus program that you are using to regain that speed.

Click Here for another way to speed up your Windows PC

Microsoft & Windows® logos are registered trademarks of Microsoft. Disclaimer: ErrorVault.com is not affiliated with Microsoft, nor does it claim such affiliation. This page may contain definitions from https://stackoverflow.com/tags under the CC-BY-SA license. The information on this page is provided for informational purposes only. © Copyright 2018

  1. 07-02-2020, 06:20 PM


    #1

    Merf is offline


    Forum Contributor


    Error 40036 When Renaming Sheet?

    I have a workbook with two summary sheets (named Summary and Summary2). Trying to copy the Summary2 sheet to a new workbook and then change the new copy’s sheet name to «Summary».
    Code is:

    The Summary2 sheet does get copied to a new workbook as intended. But I get a run-time error 40036 (application-defined or object-defined error) at the NewBook.Worksheets(1).Name = «Summary» line. What gives? Why can’t I change the name of this sheet in the new workbook?


  2. 07-02-2020, 07:53 PM


    #2

    Re: Error 40036 When Renaming Sheet?

    I cannot duplicate the error as decribed.

    Does this work?

    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.


  3. 07-02-2020, 07:57 PM


    #3

    Merf is offline


    Forum Contributor


    Re: Error 40036 When Renaming Sheet?

    Quote Originally Posted by AlphaFrog
    View Post

    I cannot duplicate the error as decribed.

    Does this work?

    Nope, that doesn’t work either. Same error.


  4. 07-02-2020, 08:26 PM


    #4

    Re: Error 40036 When Renaming Sheet?

    Show your whole code. Especially the part where you declare and set Summary2Sheet


  5. 07-02-2020, 08:42 PM


    #5

    Merf is offline


    Forum Contributor


    Re: Error 40036 When Renaming Sheet?

    Summary2Sheet is the codename for that sheet in ThisWorkbook. It is not a declared variable.
    I set up a small test subroutine; here is the entire code:

    This still gives me the same error when I run it. The error happens at the name assignment.


  6. 07-02-2020, 08:50 PM


    #6

    Re: Error 40036 When Renaming Sheet?

    I cant duplicate the error. So I’m at a loss for suggestions. Sorry.


  7. 07-02-2020, 09:24 PM


    #7

    Merf is offline


    Forum Contributor


    Re: Error 40036 When Renaming Sheet?

    Thanks anyway for trying!


  8. 07-03-2020, 09:11 AM


    #8

    Re: Error 40036 When Renaming Sheet?

    If you add this msgbox, what does it say?


  9. 07-03-2020, 09:32 AM


    #9

    Merf is offline


    Forum Contributor


    Re: Error 40036 When Renaming Sheet?

    Quote Originally Posted by Fluff13
    View Post

    If you add this msgbox, what does it say?

    If I add the Msgbox line as you wrote it, the Msgbox displays:
    Book59
    1

    If I also try to show the existing name of the new worksheet:

    then I get the same Error 40036 when the Mshbox command executes. But if I look at the Book59 window, the sheet name is actually «Summary2», and I can manually change it to «Summary» with no problem.


  10. 07-03-2020, 09:45 AM


    #10

    Re: Error 40036 When Renaming Sheet?

    Definitely odd & can’t replicate the error.
    Do you get the same problem if you try to copy a different sheet?
    Also do you get the same problem with other workbooks?


  11. 07-03-2020, 10:22 AM


    #11

    Re: Error 40036 When Renaming Sheet?

    Sometimes it’s caused on specific file. Try Debug in VBE and compile VBA Project.

    By addressing any error raised there, it may fix Error 40036 in some cases.

    Alternately… try something like below, using Workbooks.Add instead of ActiveWorkbook.
    Ex:

    ?Progress isn’t made by early risers. It’s made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein


  12. 07-03-2020, 10:56 AM


    #12

    Merf is offline


    Forum Contributor


    Re: Error 40036 When Renaming Sheet?

    I have not had this issue before (but then, I’m not sure I’ve ever written a macro that renames a sheet in another file [from ThisWorkbook]).
    I will have to play around a bit with a test file and see what I can find out. Thanks for the suggestions! Maybe this is just a quirk with this particular file.


  • #3

Tom
Thanks for your suggestion but still had the same run time error

  • #6

ACK!

I am having this error come up all of a sudden in a macro that was working fine and hasn’t been changed. I followed the tip to trace through the compile and correct all the little errors there, but it’s still happening. So I’m hoping that I’m just missing something and you wizards can pick it up.

The error is occurring on the .Unprotect line, but it occurs no matter what I do there… if I try .Activate or .Name or whatever.

TIA,
frood

Code:

Sub copyTemplate()


    Dim sheetName As String
    Dim newWorkbook As Workbook
    
    Set newWorkbook = makeNewWorkbook(1)
    
    sheetName = "blah"
    
    
    With Application
        .ScreenUpdating = False
        .EnableEvents = False
        .DisplayAlerts = False
    End With
    
        
    Workbooks("Template.xls").Sheets("Template").Copy _
        Before:=newWorkbook.Sheets(1)
    
    newWorkbook.Sheets("Sheet1").Delete
    'Removes the default sheet
    
    newWorkbook.Sheets("Template").Unprotect
    newWorkbook.Sheets("Template").Name = sheetName
        
        
    newWorkbook.Sheets(sheetName).Buttons(2).Enabled = True
    newWorkbook.Sheets(sheetName).Buttons(3).Enabled = True
    
    newWorkbook.Sheets(sheetName).Buttons(1).Delete

    addADOReference newWorkbook

    newWorkbook.Sheets(sheetName).Activate

    With Application
        .ScreenUpdating = True
        .EnableEvents = True
        .DisplayAlerts = True
    End With
    

End Sub

The macro it calls (makeNewWorkbook):

Code:

Function makeNewWorkbook(wsCount As Integer) As Workbook
    Dim originalWorksheetCount As Long
    
    Set makeNewWorkbook = Nothing
    
    If wsCount < 1 Or wsCount > 255 Then Exit Function
    
    originalWorksheetCount = Application.SheetsInNewWorkbook
    
    Application.SheetsInNewWorkbook = wsCount
    Set makeNewWorkbook = Workbooks.Add
    
    Application.SheetsInNewWorkbook = originalWorksheetCount
End Function

Last edited: Feb 26, 2010

Понравилась статья? Поделить с друзьями:
  • Vba run time error 2147221164 80040154 класс не зарегистрирован
  • Vba return error
  • Vba open file error
  • Vba on error отменить
  • Vba on error stop