Загрузка...

VBA Code That Counts Code – Yes, Really!

Counting Code So You Don’t Have To
Sub CodeCounter()

Dim CodeLineCount As Double

Set CodeLineCount_Var = ThisWorkbook.VBProject

For Each CodeLineCount_Var In CodeLineCount_Var.VBComponents
CodeLineCount = CodeLineCount + CodeLineCount_Var.CodeModule.CountOfLines
Next

CodeLineCount_Total = CodeLineCount

Set CodeLineCount_Var = Nothing

MsgBox ("Lines of code: " & CodeLineCount_Total & vbNewLine & vbNewLine & "Subs: " & Application.VBE.ActiveVBProject.VBComponents.Count)

End Sub

📊 Want to know how big your codebase really is?
In this video, I’ll show you how to write a simple tool that automatically counts the number of lines of code (LOC) and the number of procedures or functions in your files. Whether you're tracking project size, doing code analysis, or just curious—this script gives you quick, useful insights into your code.

✅ What you'll learn:

How to count lines of code with and without comments

How to identify and count functions/procedures

How to apply the script to different file types and languages

How to use the results to better understand your codebase

🛠️ Great for beginners and experienced developers alike.
📁 Works with most programming languages (with minor tweaks).
💬 Drop your questions or improvements in the comments!

👉 Don’t forget to like, subscribe, and hit the bell for more dev tools and coding tips!

#CodeMetrics #ProgrammingTools #LineCounter #FunctionCounter #CodeAnalysis #DeveloperTips

Видео VBA Code That Counts Code – Yes, Really! канала VBAMacrosAndMore
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки

На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.

Об использовании CookiesПринять