VBA Editor not autocompleting

eduzs

Well-known Member
Joined
Jul 6, 2014
Messages
704
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Why is my VBA Excel editor not autocompleting while I type the code?
For example: if I type "Selection". I'll usually expect to see the list of things I can do with it.
Maybe I disabled any setting?

Thanks
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Selection could be any type of object, so Intellisense can't really help you with that.
 
Upvote 0
Thanks all! I did not know it name is Intellisense.
And yes, VBA can't know what is the object.
Thanks.
 
Last edited:
Upvote 0
To get intellisense based on selection, would need like this (using a range object for purpose of example) :
Code:
Dim rng As Range
If TypeName(Selection) = "Range" Then
    Set rng = Selection
    [COLOR=#ff0000]rng.[/COLOR]
End If
 
Last edited:
Upvote 0
Excel's Intellisense seems lame by comparison with Word in this area, where Intellisense works quite happily even for Selection.
 
Upvote 0
That's a difference in the OM. In Word, there is a Selection class whereas there isn't in Excel, where I guess there are perhaps more options for what the selection might be, though I confess I have no idea how most of the selection properties would behave if you hadn't selected some text.
 
Upvote 0
Excel's Intellisense seems lame by comparison with Word in this area, where Intellisense works quite happily even for Selection.

I also think this, Intellisense works much more in Word.
Even a simple "cells(1,1)." Intellisense does not work, but works in "Range("A1")."
Even if I select a range of cells "Selection." Intellisense does not work.
Thanks
 
Last edited:
Upvote 0
To get intellisense based on selection, would need like this (using a range object for purpose of example) :
Code:
Dim rng As Range
If TypeName(Selection) = "Range" Then
    Set rng = Selection
    [COLOR=#ff0000]rng.[/COLOR]
End If

Thanks! You're right if I plan to use Intellisense I need firstly set selection as a range variable object.

Code:
Dim oRng As Range
Set oRng = Selection
Debug.Print oRng.Cells.Count
 
Upvote 0
Thanks! You're right if I plan to use Intellisense I need firstly set selection as a range variable object.

Code:
Dim oRng As Range
Set oRng = Selection
Debug.Print oRng.Cells.Count

If the selection is it not a range, this code will produce an error.
To avoid this, need to check that the selection is a range object (see post # 5).
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top