Consulting

Results 1 to 7 of 7

Thread: Need help writng macro to insert Spanish accented characters into a line of text

  1. #1
    VBAX Newbie
    Joined
    Jun 2019
    Posts
    4
    Location

    Need help writng macro to insert Spanish accented characters into a line of text

    I am learning Spanish and creating my own dictionary as I go. I want to make a macro that will let me quickly insert one of the accented Spanish characters (like á, for example). I can write a macro that does that, but it will only let me insert the symbol as a single letter in the cell, not after other characters in the word that come before the á. nor can I add additional text in the cell after the insertion. What am I doing wrong and what should the macro read like to allow special characters to be inserted in the middle of a text string being entered by the user?

    TIA.

  2. #2
    VBAX Expert Leith Ross's Avatar
    Joined
    Oct 2012
    Location
    San Francisco, California
    Posts
    506
    Location
    Hello hamgarn,

    Two things you should do so we can help you: Post the code you have and provide both the operating system and version of Office you are using.
    Sincerely,
    Leith Ross

  3. #3
    VBAX Newbie
    Joined
    Jun 2019
    Posts
    4
    Location
    Quote Originally Posted by Leith Ross View Post
    Hello hamgarn,

    Two things you should do so we can help you: Post the code you have and provide both the operating system and version of Office you are using.

    Oops - sorry. This is the first time I've asked for help.
    Brand new computer - does that make it Windows 10?
    Excel in Office 365

    With the cursor in cell A1 when I write the macro, the code comes out like shown below. I can't get the macro to stop recording after entering the accented a - it won't accept the STOP RECORDING command (or even make it an option in the drop down menu) until I hit ENTER to put the cursor in the next cell, which is why the second line of code shows A2. I don't want to go to the next cell - I just want to insert a special character into a line of text (with text on either side of the special character) in a cell.

    Sub á()
    '
    ' á Macro
    ' Insert Spanish accented a
    '
    ' Keyboard Shortcut: Ctrl+Shift+A
    '
    ActiveCell.FormulaR1C1 = "á"
    Range("A2").Select
    End Sub

    TIA!

  4. #4
    VBAX Expert Leith Ross's Avatar
    Joined
    Oct 2012
    Location
    San Francisco, California
    Posts
    506
    Location
    Hello hamgarn,,

    You made not even need a macro, You can change the input language and keyboard from English to Spanish and back again using the Language Toolbar. Right click the Taskbar then click Toolbars... and select language.

    Keyboards and Languages.jpg
    Sincerely,
    Leith Ross

  5. #5
    VBAX Newbie
    Joined
    Jun 2019
    Posts
    4
    Location
    That's an interesting idea but I don't think it will work bc I am making a dictionary, so half the words are in English and half are in Spanish. It looks like it would be a pain to toggle back and forth. Would it be possible to ask for help with doing it via a macro? I only need to be able to input six characters that have accents or tildes, not a whole alphabet.

  6. #6
    VBAX Expert
    Joined
    Apr 2005
    Posts
    756
    Location
    How do you want to proceed? Use replace like if the sentence in English is tomorrow, change it to mañana?
    All you would need is have the english words/letters in column A and the equivalent spanish words in thye cell next to it.
    Read it all in an array and go and look for the english words/letters and change to spanish.

  7. #7
    VBAX Newbie
    Joined
    Jun 2019
    Posts
    4
    Location
    No, it isn't a question of replacing an English word with a Spanish word. I need to enter both the English word in one column and the Spanish word in the next column. For example, on the Excel tab for adjectives, I have a column for the English words, were I would enter 'small', and one column over, which is for the Spanish word equivalent, I need to enter the word 'pequeña' and I'd really like not to have to go to either the INSERT SYMBOL menu or the series of strokes ALT 0241, which is disruptive and requires moving one if not both hands away from standard keyboard position (the ALT key is hard to get to and once I move to find it, it's easier to use the number pad). So I really need a macro like CTL SHIFT N to do the ñ bc it's a lot faster and more accurate/reliable.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •