+ Reply to Thread
Results 1 to 6 of 6

Navigation throught userforms

  1. #1
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Navigation throught userforms

    Hello Again,
    I have several userform, where two buttons can be found, forward to next userform and backward to the former one. They work.. The issue is the following: Lets say I am on userform 2 and I would like to go backward to userform 1. But not only would I like to go back but I would like to see the data from userform 1, that I put into the textboxes before. Right now the textboxes are emtpy when I go back. Someone told me that I need to put the the same code that I have on command button 1 (forward) on command button 2(backward) to make this work. This is obviously not the case. Thnks for first help.

    Best
    Matthias

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Navigation throught userforms

    Don't unload userform1 on showing userform2, just hide it - the boxes will then still be populated

  3. #3
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Re: Navigation throught userforms

    Okey thank you, this worked --> I do however have another problem now.. The thing is that every time I go back to the userform the values are printed into the excel sheet, which should not not be the case. It should rahter overwrite them..

    This is beause of the following code lines --> look the third one:
    [Worksheets("Datenbank").Activate]

    [Dim intErsteLeereZeile As Long]

    [intErsteLeereZeile = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row + 1 ]

    [ActiveSheet.Cells(intErsteLeereZeile, 1).Value = TextBox10 ]

    ...

    I only use this code for the first userform. For the others your sugggestion works perfectly

  4. #4
    Forum Contributor
    Join Date
    12-11-2018
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    130

    Navigation throught userforms 2.0

    Hello,

    This morning I posted a thread, called "Navigation throught userforms". That one was solved but new problems occured...

    I can now navigate throught the userform as wished (look Navigation throught userforms). Problem is that within the first userform I have a codeline that always looks for the next line to write in the data, entered in the userform. So when I go to userform 2 and then back to userform 1, the data which is contained in userform 1 is written a second time into my excel sheet, instead of replacing it (look code now).

    Please Login or Register  to view this content.



    Is there a way I can tell my macro that, when I start the whole macro from the beginning it should write the data into the next excel line, and when I come back from userform 2 it should overwrite the data from userfom 1 and not make a new line...

    ---> In the example sheet you can see the when I go from userform 2 back to userform one and then back to number 2 it rewrites the value from textbox below the entry again... It should overwrite it.

    Thanks
    Attached Files Attached Files
    Last edited by AliGW; 12-15-2018 at 06:07 AM. Reason: Code tags added.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Navigation throught userforms 2.0

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  6. #6
    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,719

    Re: Navigation throught userforms

    Two things:

    1. Please do not open new threads for follow-on questions.
    2. Use code tags in your posts (added for you this time - see our rules).
    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.

+ 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. Forecast throught multiple sheets
    By a1b2c3d4e5f6g7 in forum Excel General
    Replies: 9
    Last Post: 05-03-2014, 10:44 AM
  2. [SOLVED] Reference to a sheet name throught text
    By ecelaras in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-16-2013, 07:43 AM
  3. Creating Pivot throught Macro
    By vkaushal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-23-2013, 06:27 PM
  4. Cycle throught Text Boxes in UserForms
    By tom.hogan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2011, 11:44 AM
  5. loop throught all the sheets without selecting them
    By caliskier in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2008, 09:54 AM
  6. Tabbing Throught Cells
    By mikey0086 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-03-2008, 11:32 AM
  7. Tab throught unlocked cells
    By dziw in forum Excel General
    Replies: 7
    Last Post: 01-08-2008, 05:01 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