Issue with Incorrect VBA Syntax in Microsoft Excel Documentation

Anonymous
2025-05-12T05:22:51+00:00

Dear Microsoft Support,

I would like to bring to your attention an issue I encountered in the VBA documentation and related online resources. It appears that there is a discrepancy regarding the usage of the "Target" variable in the Worksheet_SelectionChange event.

In multiple instances, the variable is incorrectly written as "Targed", which causes confusion and errors when implementing VBA code. The correct syntax should be "Target", with a lowercase "t" at the end, as it is the standard variable name for referring to the selected cell or range.

This inconsistency may lead to unnecessary troubleshooting, as users may unknowingly use the incorrect spelling "Targed", causing errors in their code.

I am using the English version of Microsoft Office, and this issue has affected my work. I kindly request that this be addressed and corrected in future documentation updates to ensure clarity and accuracy for Excel users, especially those using localized versions of Office.

 Kind regards,
Dainis

p.s. Book1.xlsm

I created a new document and added the macro to it. If anyone has big eggs, they can save and boil them. :)

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

8 answers

Sort by: Most helpful
  1. Andreas Killer 144K Reputation points Volunteer Moderator
    2025-05-12T07:48:04+00:00

    Dainis,

    first of all, this is a user forum, we do not collect or report bugs here. Please use the feedback function of your application for this:

    How do I give feedback on Microsoft Office? - Office Support

    Second, it doesn't matter how the variable is spelled, also this works:

    Private Sub Worksheet_SelectionChange(ByVal Whatever As Range)
      MsgBox Whatever.Address
    End Sub
    

    Third, in the Online Documentation there is a translator which automatically translated parts which should not be translated, because the spelling in VBA is English all around the world. This is a know issue and happens if you call the documentation with a different language identifier.

    Also some browsers automatically translate parts of websites. That might be happen on your system, I can see Target in
    https://learn.microsoft.com/en-us/office/vba/api/excel.worksheet.selectionchange

    Fourth, to prevent spelling errors in your code add the line

    Option Explicit

    at the top of the module and you'll get an error if there is a variable in your code that is not declared.

    Andreas.

    0 comments No comments
  2. Anonymous
    2025-05-12T08:03:35+00:00

    Thanks for the suggestion. Please show me where something is translated? I use English Excel and nothing is translated there. If you see it in the title, then it doesn't mean anything. The pictures are from the same file! Everywhere it is recommended to use the "Target" command, but I get an error! If you don't have a specific solution where to look, don't waste your time! Thanks for understanding.

    0 comments No comments
  3. Andreas Killer 144K Reputation points Volunteer Moderator
    2025-05-12T08:48:48+00:00

    I can see that you installed an English US version of Office 2019 on a system which is obvious not English US.

    This is not an issue in general, it works, but your system's regional settings / installed library's are taken into account too. If you think you can install an English program and everything will be in English, then you are wrong.

    All this may confuse you, but it's your own fault. You mixed it up, not Microsoft, your machine did not work as you expect.

    Andreas.

    0 comments No comments
  4. Anonymous
    2025-05-12T09:55:06+00:00

    I would like to draw your attention once again, these are the built-in Excel variables and not the ones I wrote! I use Visual Studio on this computer and all the variables, classes and functions work without problems. If you are trying to say that my regional settings are to blame. Then I have a question: why does Microsoft produce products that are adapted to regions and those languages? p.s. I will look at my home computer in the evening, I have 365 office there.

    It may be that someone has had something similar and the person simply cannot understand why the example from the internet does not work on their computer. My personal thoughts are that the problem could be in Excel itself.

    0 comments No comments
  5. Andreas Killer 144K Reputation points Volunteer Moderator
    2025-05-12T15:03:54+00:00

    I have over 30 years of experience with Excel, so you can trust me that there are more things between heaven and earth than you've seen so far. ;-)

    If you need a purely English-US system for testing or development, I recommend installing a virtual machine with an operating system in English-US, and then installing Office in English-US on it. I've been doing it this way for many years, and it works.

    Andreas.

    0 comments No comments