+ Reply to Thread
Results 1 to 3 of 3

Cells.Select strange behaviour

  1. #1
    Registered User
    Join Date
    06-04-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    2016
    Posts
    27

    Cells.Select strange behaviour

    Hi,
    I have a userform with a listbox. When the user selects a value from the listbox, the userform closes and a cell on the spreadsheet is automatically selected.
    This works as intended, but with the following problem shown in this example:
    1. The currently selected cell is B3
    2. The user opens the form, selects a value from the listbox.
    3. The form closes and D5 is selected with VBA code.
    4. The user starts typing, but the text is being written in cell B3 (the previously selected cell), and with that cell's formats.
    5. When the user presses return or deselects the cell, the text correctly appears in cell D5, but still has the formats from cell B3.

    I have no idea why this is happening and have tried different combinations of things e.g:
    - putting 'unload me' before and after the cell selection.
    - selecting the cell twice.
    - enabling / disabling events before and / or after the cell selection.

    I would love some ideas!

    Thanks very much.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Cells.Select strange behaviour

    Difficult to say without seeing the workbook.

    Please upload it and in some notes explain how you use it, what values you enter/input into cells and/or listbox and what you expect to happen to any cells that are dependent on that input.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    06-04-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    2016
    Posts
    27

    Re: Cells.Select strange behaviour

    I've uploaded a link to the workbook here as it won't let me upload a file. It's nearly all VBA based.

    To see what's happening:
    1. Select cell F2.
    2. Press 'Add New Student' button.
    3. Type 'a' into the textbox and press the 'Find' button.
    4. Double click on 'Aber, Parson' in the listbox.
    5. Without clicking anything else, type something. (You should see that it looks like it is typing in cell F2)
    6. Press [Return] and the text will then appear in the correct cell - I7 - but will have the same text formatting as cell F2.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] strange behaviour from vba
    By harryv27 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-14-2016, 04:50 AM
  2. Strange Behaviour
    By Mark@Work in forum Excel General
    Replies: 2
    Last Post: 09-30-2008, 12:22 PM
  3. [SOLVED] Strange if(***) behaviour?
    By Excel 2003 - SPB in forum Excel General
    Replies: 6
    Last Post: 08-06-2006, 12:35 PM
  4. Strange "Format>Cells" behaviour
    By Mike Hyndman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-24-2005, 10:05 AM
  5. [SOLVED] Strange VBA Behaviour
    By Ricko in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-28-2005, 03:05 AM
  6. Very strange add-in file behaviour
    By RB Smissaert in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-18-2005, 02:45 PM
  7. [SOLVED] Strange behaviour
    By Edgar Thoemmes in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-08-2005, 12:06 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1