Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2021, 06:43 PM
coffent coffent is offline How to get Excel VBA to auto-indent code? Windows 10 How to get Excel VBA to auto-indent code? Office 2019
Advanced Beginner
How to get Excel VBA to auto-indent code?
 
Join Date: Dec 2019
Posts: 40
coffent is on a distinguished road
Default How to get Excel VBA to auto-indent code?

In VBA, I have Tools > Options > Editor > Auto Indent checked, yet it doesn't auto-indent my code. For example in a For loop the lines between For and Next remain unindented. Why? Is there a way to force it to indent the code? If not, is there a good add-in for doing this? Thanks.
Reply With Quote
  #2  
Old 10-08-2021, 06:36 AM
p45cal's Avatar
p45cal p45cal is offline How to get Excel VBA to auto-indent code? Windows 10 How to get Excel VBA to auto-indent code? Office 2019
Expert
 
Join Date: Apr 2014
Posts: 863
p45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant future
Default

Ha! It's a cheek I know, and it's been like that for decades. It doesn't work as you think it will:
Auto Indent functions when you press Enter key to start a new line, if the code before you press Enter has indentation, the new line will begin at the position of the previous indentation. If you don’t turn on the Auto Indent function, the next line will start on the left.
Reply With Quote
  #3  
Old 10-08-2021, 06:58 AM
coffent coffent is offline How to get Excel VBA to auto-indent code? Windows 10 How to get Excel VBA to auto-indent code? Office 2019
Advanced Beginner
How to get Excel VBA to auto-indent code?
 
Join Date: Dec 2019
Posts: 40
coffent is on a distinguished road
Default

Thanks for the information. It does seem that a decades-old function might be ready for some improvement!
Reply With Quote
Reply

Tags
auto indent

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Excel VBA to auto-indent code? Code for Indent if criteria is true Marcia Excel Programming 5 02-20-2020 06:28 PM
Difference between first line Indent and Left Indent kingston123 Word 3 09-25-2018 02:47 PM
Undo auto indent Karen J. Word 3 02-07-2018 03:24 PM
How to get Excel VBA to auto-indent code? Issue of 2 fixed bullet points indent setting work together (code included) puff Word VBA 5 12-17-2017 05:52 PM
How to get Excel VBA to auto-indent code? auto-indent mickeyd Excel 1 06-14-2013 04:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:55 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft