Как переименовать модули в excel

ГЛАВНАЯ

ТРЕНИНГИ

   Быстрый старт
   Расширенный Excel
   Мастер Формул
   Прогнозирование
   Визуализация
   Макросы на VBA

КНИГИ

   Готовые решения
   Мастер Формул
   Скульптор данных

ВИДЕОУРОКИ

ПРИЕМЫ

   Бизнес-анализ
   Выпадающие списки
   Даты и время
   Диаграммы
   Диапазоны
   Дубликаты
   Защита данных
   Интернет, email
   Книги, листы
   Макросы
   Сводные таблицы
   Текст
   Форматирование
   Функции
   Всякое
PLEX

   Коротко
   Подробно
   Версии
   Вопрос-Ответ
   Скачать
   Купить

ПРОЕКТЫ

ОНЛАЙН-КУРСЫ

ФОРУМ

   Excel
   Работа
   PLEX

© Николай Павлов, Planetaexcel, 2006-2022
info@planetaexcel.ru


Использование любых материалов сайта допускается строго с указанием прямой ссылки на источник, упоминанием названия сайта, имени автора и неизменности исходного текста и иллюстраций.

Техническая поддержка сайта

ООО «Планета Эксел»

ИНН 7735603520


ОГРН 1147746834949
        ИП Павлов Николай Владимирович
        ИНН 633015842586
        ОГРНИП 310633031600071 

При первой вставке модуля в VBA ему автоматически будет присвоено имя «Модуль1», А последующий модуль станет Module2, Module3 и т. Д. Аналогичным образом, когда вы вставляете пользовательскую форму, она будет называться UserForm1, UserForm2 и т. Д.

Переименование модуля

Чтобы переименовать модуль или форму, вам необходимо включить окно свойств в вашем VBE.

Если окна свойств не отображаются, нажмите F4 или перейдите в строку меню и выберите Вид, Характеристики Окно.

  1. Щелкните модуль, который хотите переименовать, в Обозреватель проекта.
  2. Выберите свойство name в Окно свойств (модуль будет иметь только это свойство; форма имеет несколько свойств)

3. Удалите имя модуля (в данном случае Module1) и введите имя, которое вы хотите назвать своим модулем.

4. Нажмите Enter, чтобы переименовать модуль.

Таким же образом вы переименовываете свои формы.

Удаление модуля

Иногда вам может потребоваться удалить модуль или форму, которые вам больше не нужны.

Щелкните правой кнопкой мыши модуль или форму, которые вы хотите удалить, чтобы отобразить контекстное меню, вызываемое правой кнопкой мыши.

Нажмите Удалять (в этом случае Модуль2)

ИЛИ

Нажать на Файл меню, а затем нажмите Удалите (Module2).

Появится окно с предупреждением, в котором вас спросят, хотите ли вы экспортировать модуль или форму, прежде чем удалять их. Экспорт модуля или формы позволяет сохранить его как отдельный файл для использования в другом проекте Excel в другое время.

Чаще всего, когда вы удаляете модуль или форму, это происходит потому, что он вам не нужен, поэтому нажмите Нет.

Именование модулей и форм

Рекомендуется переименовывать модули и формы, чтобы дать им более понятные имена. Например, если UserForm1 будет формой для ввода сведений о счете, мы можем переименовать ее в frmInvoices. Точно так же, если Module1 будет использоваться для хранения некоторых общих функций, которые будут повторно использоваться в вашем коде, вы можете переименовать его в basGeneral или modGeneral (в зависимости от того, какие соглашения об именах вы хотите использовать).

Рекомендуется соблюдать соглашения об именах как при именовании ваших модулей и форм, так и переменных, которые вы используете в своем коде. Вы заметите, что я написал первые 3 буквы имени модуля или формы в нижнем регистре и поставил заглавную букву в начале описания модуля или формы. Это известно как CamelCase (https://en.wikipedia.org/wiki/Camel_case) и является хорошей привычкой при именовании объектов. Я также использовал соглашение об именах Лешинского, которое часто используется программистами Visual Basic. (https://en.wikipedia.org/wiki/Leszynski_naming_convention).

Вы поможете развитию сайта, поделившись страницей с друзьями

This Excel tip shows you how to rename a module in Excel. This is a very important thing to do when you have a large number of macros in a workbook and you need to keep track of what is contained in every module.

Modules are just one place to insert a macro but this is the most widely used place location for Excel macros.

Steps for renaming an Excel Macro Module:

  1. Highlight the desired module by clicking it once.
  2. Go to the box/window right below where the modules are visible. This is called the «Poperties» window.
    • If the Properties window is not visible, press «F4» on the keyboard.
  3. Click in the box next to where it says «(Name)» and rename the module. By default you will see the text «Module1» or «Module2» etc.

Steps for renaming an Excel Macro Module with pictures:

  1.  
  2. Module in Excel

  3.  
  4. Property Window in Excel

  5.  
  6. Display Property Window in Excel

  7.  
  8. Rename Module in Excel


Excel VBA Course

Excel VBA Course — From Beginner to Expert

200+ Video Lessons
50+ Hours of Instruction
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel

AutoFilter with an Excel Macro

Tutorial: This Excel tip shows you how you can use an Excel Macro in order to run a Filter on data w…

Install a Macro into an Excel Spreadsheet

Tutorial: This tip will show you how to copy an Excel Macro into your workbook or spreadsheet. You w…

Add Comments to Cells with an Excel Macro

Macro: Add comments to cells in Excel with this macro. This allows you to quickly and easily add …

Set a Photo/Image as an Excel Worksheet Background

Tutorial: One of the really cool formatting features of Excel is that you can actually set a pictur…

Me Keyword in Excel Macros & VBA

Tutorial: The Me keyword in Excel VBA allows you to refer to either the current worksheet, workbook,…

Use Macros with UserForms

Tutorial: This tutorial explains how macros interact with UserForms.
This includes an explanation of…

Subscribe for Weekly Tutorials

BONUS: subscribe now to download our Top Tutorials Ebook!

Excel VBA Course

Excel VBA Course — From Beginner to Expert

200+ Video Lessons

50+ Hours of Video

200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

    msm.ru

    Нравится ресурс?

    Помоги проекту!

    Популярные разделы FAQ:    user posted image Общие вопросы    user posted image Особенности VBA-кода    user posted image Оптимизация VBA-кода    user posted image Полезные ссылки


    1. Старайтесь при создании темы указывать в заголовке или теле сообщения название офисного приложения и (желательно при работе с Office 95/97/2000) его версию. Это значительно сократит количество промежуточных вопросов.
    2. Формулируйте вопросы как можно конкретнее, вспоминая (хотя бы иногда) о правилах ВЕЛИКОГО И МОГУЧЕГО РУССКОГО ЯЗЫКА, и не забывая, что краткость — сестра таланта.
    3. Не забывайте использовать теги [сode=vba] …текст программы… [/code] для выделения текста программы подсветкой!
    4. Темы с просьбой выполнить какую-либо работу полностью за автора здесь не обсуждаются и переносятся в раздел ПОМОЩЬ СТУДЕНТАМ.

    >
    Переименовать модуль в VBA-EXCEL

    • Подписаться на тему
    • Сообщить другу
    • Скачать/распечатать тему



    Сообщ.
    #1

    ,
    16.06.04, 08:57

      Люди добрые !
      Почему я не могу переименовать модуль в VBA-EXCEL ? :wall:

      Встаю на имя модуля, нажимаю правую кнопку мышки.
      Есть «Создать», есть «Удалить». «Переименовать» — нету…
      Так и называются мои модули: ‘Module3’, ‘Module5’. :(

      Не может быть, чтобы «все так жили».
      Может надо какие-то опции включить в «свойствах проекта» ?

      У меня Excel-2002.


      Visitor



      Сообщ.
      #2

      ,
      16.06.04, 09:06

        В редакторе VB в меню:
        View — Properties Window
        и там менять св-во (Name)

        0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)

        0 пользователей:

        • Предыдущая тема
        • VB for Application
        • Следующая тема

        Рейтинг@Mail.ru

        [ Script execution time: 0,0194 ]   [ 16 queries used ]   [ Generated: 15.04.23, 21:19 GMT ]  

        Return to VBA Code Examples

        In this Article

        • How to Rename or Delete a VBA module or Form
        • Renaming a Module
        • Delete a Module
          • Name Modules & Forms

        How to Rename or Delete a VBA module or Form

        The first time you insert a module in VBA, it will automatically be given the name of “Module1” and subsequent module will become Module2, Module3 etc. Similarly, when you insert a UserForm it will be called UserForm1, UserForm2 etc.

        VBA 15 PIC 01

        Renaming a Module

        To rename your module or form, you need to have the properties window switched on in your VBE.

        If the properties windows is not showing, press F4 or go to the menu bar and select View > Properties Window.

        VBA 15 PIC 02

        1. Click on the module you wish to rename in the Project Explorer.
        2. Select the name property in the Properties Window (a module will only have this property; a form has multiple properties)VBA 15 PIC 03

        3. Delete the module name (in this case Module1) and type in the name you want to call your module.

        VBA 15 PIC 04

        4. Press enter to rename the module.

        VBA 15 PIC 05

        You rename your forms in the same manner.

        Delete a Module

        Occasionally you may have the need to remove a module or form that you no longer need.

        Right-click on the module or form you wish to remove to show the right click short cut menu.

        VBA 15 PIC 06

        Click Remove (in this case Module2)

        OR

        Click on the File menu, and then click on Remove (Module2).

        VBA 15 PIC 07

        A warning box will appear asking if you want to Export the module or form before you remove it. Exporting the module or form enables you to save it as an individual file for use in a different Excel project at some other time.

        VBA 15 PIC 08

        More often than not when you remove a module or form it is because you do not need it, so click No.

        Name Modules & Forms

        It is good practice to rename modules and forms in order to give them more meaningful names. For example, if UserForm1 is going to be a form for entering invoice details, we can rename it to frmInvoices.  Similarly, if Module1 is going to be used to hold some general functions that are going to be used repetitively throughout your code, you could rename it to basGeneral or modGeneral (depending on which naming conventions you like to use).

        It is a good idea to be consistent with the naming conventions, both in naming your modules and forms, as well as the variables that you use within your code.  You will notice that I have written the first 3 letters of the module or form name in lowercase, and have a capital letter at the beginning of the description for the module or form.  This is known as CamelCase (https://en.wikipedia.org/wiki/Camel_case) and is a good habit to  get into when naming your objects. I have also used the Leszynski naming convention which is often used by Visual Basic programmers. (https://en.wikipedia.org/wiki/Leszynski_naming_convention).

        VBA Coding Made Easy

        Stop searching for VBA code online. Learn more about AutoMacro — A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!
        vba save as

        Learn More!

        Понравилась статья? Поделить с друзьями:
      • Как переименовать кнопка в excel
      • Как переименовать книгу в excel 2007
      • Как переименовать книгу excel на vba
      • Как переименовать категории в диаграмме excel
      • Как переименовать имя файла в excel