+ Reply to Thread
Results 1 to 21 of 21

Adapt Code for 1D Range Data Entry to Work With 2D Range

  1. #1
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Adapt Code for 1D Range Data Entry to Work With 2D Range

    This code allows editing of cells via userform textboxes.
    Class modules are used to transfer contents as you type.
    Most has been developed by others.

    A selection is made and the userform is populated when the macro is run. There is a differentiator ... the order of showing textboxes is by processing cells Down then Across, which is not the default, the default is Across then Down.
    Up to this point, it works.

    When it comes to editing the cell using a textbox, the wrong cell is changed (except for first and last cells). The link between the cell and textbox is still the default.

    Please advise fix.


    CLASS MODULE clsBoxes
    Please Login or Register  to view this content.
    CLASS MODULE clsDelegate
    Please Login or Register  to view this content.
    CLASS MODULE clsTyping
    Please Login or Register  to view this content.

    FORM CODE
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by AliGW; 11-01-2019 at 04:41 AM. Reason: Title improved.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Linking cells with userform textbox

    There is nothing wrong.
    It depends on your sequencing when selecting the macro.
    Choose the cell first then the macro it works, chose the macro first then the cell it gets confused.
    A mass of code acheiving so little, what is the point in causing yourself so much frustration.
    torachan

  3. #3
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Linking cells with userform textbox

    what is the point in causing yourself so much frustration
    I'm not sure how to answer this.
    Is it not clear in the question?

  4. #4
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Linking cells with userform textbox

    Bumping up.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Linking cells with userform textbox

    Unfortunately, you have not addressed the query. Re-read post #2 in its entirety, particularly this:

    Choose the cell first then the macro it works, chose the macro first then the cell it gets confused.
    Does this cover the problems you are facing? Because, if not, you need to explain this in more explicit detail:

    When it comes to editing the cell using a textbox, the wrong cell is changed (except for first and last cells).
    In other words, give an example of what you are describing (wrong outcomes) and what you think the correct outcomes should be.

    EDIT: I have just looked at your workbook and see now what you mean - it would have been useful to show the visual within your opening post!
    Last edited by AliGW; 10-31-2019 at 05:09 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Linking cells with userform textbox

    I can't understand what this means in post #2.
    Choose the cell first then the macro it works, chose the macro first then the cell it gets confused.
    With respect to the following in the original question, for the first and last cell, the processing sequence is the same whether Down then Across, or Across then Down.
    When it comes to editing the cell using a textbox, the wrong cell is changed (except for first and last cells).
    To describe again, see attached snapshot, if I edit the "4. Fourth" textbox, I expect a change in the "4. Fourth" cell. Instead a change is made in "6. Sixth" cell. So the textboxes are setup correctly but the relationship to the cell is still the default which is Across then Down.

    By the way, very quick response time.

    Attachment 647562

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Linking cells with userform textbox

    Quick because I happen to be here - we are all volunteers doing this in our free time, remember.

    I think, if I were you, I'd change the thread title to something like this: "Changing Default Direction in User Form from Across then Down to Down then Across". This might just pique some interest.

  8. #8
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Changing Default Direction in User Form from Across then Down to Down then Across

    OK thanks, I am aware of the volunteer aspect.

    It only changed the title in the last post. Can I start a new thread?
    Last edited by Un-Do Re-Do; 10-31-2019 at 05:35 AM.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Linking cells with userform textbox

    No - go back and edit the FIRST post - change the title there, please.

    EDIT: I've done it for you.

    By the way, are you really still using Excel 2007? If not, your forum profile needs updating, please.
    Last edited by AliGW; 10-31-2019 at 05:41 AM.

  10. #10
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Linking cells with userform textbox

    Unfortunately I can't do this. How is it done?
    I'm using Firefox.

    EDIT. Thanks for changing. Yes I am still using 2007.

  11. #11
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Linking cells with userform textbox

    In Sheet2 code event.
    The form is being called 'modeless', allowing access to sheet in an out of order sequence.
    Change this (to the below)and it makes it idiot proof.

    Please Login or Register  to view this content.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Changing Default Direction in User Form from Across then Down to Down then Across

    Unfortunately I can't do this. How is it done?
    On reflection I think that too much time has passed for you to be able to, which is why I did it for you.

    Let us know how you get on with the suggestion in post #11 above.

  13. #13
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Changing Default Direction in User Form from Across then Down to Down then Across

    Sorry but the code in post #11 does not work.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Changing Default Direction in User Form from Across then Down to Down then Across

    Are you able to attach a workbook in which you have tried to implement it so that Torachan can check it for you? It may be that you have made a small mistake somewhere.

  15. #15
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Changing Default Direction in User Form from Across then Down to Down then Across

    Please see attached.
    Attached Files Attached Files

  16. #16
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Changing Default Direction in User Form from Across then Down to Down then Across

    I am old and slow, I was only selecting ONE item at a time, it worked every time.
    However if you select the matrix it DOES fall over.
    Looking through the code it would appear to be only capable of working with one column OR one row NOT both at the same time.
    Did the original that you copied the code from ever work on a matrix ??????

  17. #17
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Changing Default Direction in User Form from Across then Down to Down then Across

    By matrix I assume you mean a 2D range.
    Yes the issue is with this.

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Changing Default Direction in User Form from Across then Down to Down then Across

    Can you answer Torachan's final question? Yes, he means the 2D range.

  19. #19
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Changing Default Direction in User Form from Across then Down to Down then Across

    Did the original that you copied the code from ever work on a matrix ??????
    This is the issue that it doesn't work on a matrix.

  20. #20
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Changing Default Direction in User Form from Across then Down to Down then Across

    Time for another title change ?

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Adapt Code for 1D Range Data Entry to Work With 2D Range

    Agreed and done.

+ 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] Get cells value in textbox userform
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2017, 02:13 AM
  2. Userform textbox to combine all cells comments
    By mariec_06 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-05-2016, 10:53 AM
  3. update cell/cells after updating a textbox on a userform
    By 40jmart1705 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2014, 03:07 PM
  4. [SOLVED] Placing the data from a range of cells into a userform textbox
    By brucemc777 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2014, 03:51 PM
  5. UserForm textbox data to empty cells
    By RLWells in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2012, 02:42 AM
  6. Linking Cells to Textbox on a Userform
    By Mpeters3 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2011, 01:15 PM
  7. Copying userform data in textbox into cells
    By dowinterfor6 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-21-2011, 02:10 PM

Tags for this Thread

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