+ Reply to Thread
Results 1 to 20 of 20

Move commandbutton to up or down to range is selected by combobox on userform

  1. #1
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Move commandbutton to up or down to range is selected by combobox on userform

    Hello
    yesterday I got help by Marc in this thread
    https://www.excelforum.com/excel-pro...x-on-form.html
    when I select name form combobox1 will match name with column I and show the range without using scroll bar. now I want when show the range as if it's in first range should move command button to next to range because if I close form and will run again I don't want to have to move up to click command button especially if the range is down
    in other meaning when show the range so should move command button to beside the range is showing.
    in picture 1 this what code does it now
    in the picture2 what I want it.

    thanks
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Ali-M; 07-09-2023 at 06:46 AM.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello, try this ...


    According to your previous tread attachment no need to move the button with this VBA procedure
    to paste only to the UserForm1 module :

    PHP Code: 
    Private Sub UserForm_Terminate()
        
    Windows(1).ScrollColumn 1:  Windows(1).ScrollRow 1
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb ... or this !


    If you prefer to move the button then insert this red codeline :
    Please Login or Register  to view this content.
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  4. #4
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Move commandbutton to up or down to range is selected by combobox on userform

    thanks Marc , but it doesn't move the command button . it keep down as in attached , when select name above the command button keep down .

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move commandbutton to up or down to range is selected by combobox on userform


    Well works on my side with this thread attachment …

  6. #6
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Move commandbutton to up or down to range is selected by combobox on userform

    Well works on my side with this thread attachment …
    really strange !!
    and will shows error object required after close userfrom in this line
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Ali-M; 07-09-2023 at 09:42 AM.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move commandbutton to up or down to range is selected by combobox on userform


    According to post #1 attachment this codeline can't be activated when the userform is closed as located in your ComboBox1_Change event.
    Last edited by Marc L; 07-09-2023 at 12:00 PM.

  8. #8
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Move commandbutton to up or down to range is selected by combobox on userform

    so you mean I should put in commandbutton your original code ?
    if it's so I got the same result !

  9. #9
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move commandbutton to up or down to range is selected by combobox on userform


    No it's very not what is written in my previous post …

  10. #10
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Move commandbutton to up or down to range is selected by combobox on userform

    No it's very not what is written in my previous post …
    Now I'm shocked
    is it yours ?

    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Move commandbutton to up or down to range is selected by combobox on userform


    As I wrote « as located in your ComboBox1_Change event » !

  12. #12
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Move commandbutton to up or down to range is selected by combobox on userform

    did you read my post#8 ?
    the original code is in commandbutton1 and I ask for you
    I should put in commandbutton your original code ?
    you don't answer me clearly .
    so if I did it as in original code ,the problem is still show because of your suggestion in post#3
    so I thought the problem is not from ComboBox1_Change event because the same problem happens with commandbutton1_click event !

  13. #13
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move commandbutton to up or down to range is selected by combobox on userform


    Still according to post #7 for good enough readers :

    Quote Originally Posted by Marc L View Post
    According to post #1 attachment this codeline can't be activated when the userform is closed as located in your ComboBox1_Change event.
    As your attachment does not contain a CommandButton1_Click event …
    Last edited by Marc L; 07-10-2023 at 07:34 AM.

  14. #14
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Move commandbutton to up or down to range is selected by combobox on userform

    As your attachment does not contain a CommandButton1_Click event …
    you mean the code is not existed in CommandButton1_Click event ?
    I asked you in post#8 , I don't get clear answering .
    I understand from your comment in post#9 the code is not yours totally.
    even if that I told you more than one time if I put in your code in CommandButton1_Click event the same error continues show !

  15. #15
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move commandbutton to up or down to range is selected by combobox on userform


    Quote Originally Posted by Ali-M View Post
    you mean the code is not existed in CommandButton1_Click event ?
    No you misread again as I wrote CommandButton1_Click event does not exist !
    So just open your post #1 attachment of this thread and check !


    Quote Originally Posted by Ali-M View Post
    I asked you in post#8 , I don't get clear answering .
    Already answered in posts #5 & 7 if you had well read them !


    Quote Originally Posted by Ali-M View Post
    I understand from your comment in post#9 the code is not yours totally.
    Wrong, you misread / misunderstood again and how by hell is it possible you deduced that with my post #9 ?‼
    No sense at all …


    Quote Originally Posted by Ali-M View Post
    if I put in your code in CommandButton1_Click event the same error continues show
    Why as again this event does not exist in this thread post #1 attachment ?‼
    Only my post #2 stated to your previous thread …
    But not my next post as explicitly explained again & again since post #5 !


    As it well works on my side - whatever in which VBA procedure - just inserting the post #3 red codeline
    so the weird is on yours and I can't guess what you have badly done except misreading, not following the directions …
    Last edited by Marc L; 07-10-2023 at 10:56 AM.

  16. #16
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Post Re: Move commandbutton to up or down to range is selected by combobox on userform


    ( removed as the forum does not well work when uploading a gif video file …)
    Last edited by Marc L; 07-10-2023 at 12:31 PM.

  17. #17
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move commandbutton to up or down to range is selected by combobox on userform


    See this video

  18. #18
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Move commandbutton to up or down to range is selected by combobox on userform

    CommandButton1_Click event is existed whether in this thread or previous thread and when you answer me in previous thread when you put the code in CommandButton1_Click event I don't care because works for me when I put in ComboBox1_Change event and I really what I want it .
    the only thing is different I put in ComboBox1_Change event .
    so as I see from your last comment and seem there is no solution for this strange case.

  19. #19
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Move commandbutton to up or down to range is selected by combobox on userform

    if you don't attach the video then you can't help me and I can't find my bad !
    now I misunderstood totally in post#3
    when you comment in post#2 I connect it with post#3 then I put like this
    Please Login or Register  to view this content.
    that's why shows error , but after I see the video then snipped red should be in ComboBox1_Change
    sorry it takes more time to understand your suggestion
    now your code works excellently
    thank you so much .
    Last edited by Ali-M; 07-10-2023 at 01:10 PM.

  20. #20
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Move commandbutton to up or down to range is selected by combobox on userform


    As explained in posts since post #5, post #3 stating for inserting only the red codeline and not all ‼
    Solution always comes to good enough readers …
    Last edited by Marc L; 07-10-2023 at 01:12 PM.

+ 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] Use commandbutton to show text in cell range in Userform with textbox
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-25-2023, 05:53 AM
  2. UserForm - Commandbutton to populate a label based on Combobox
    By zuewl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-15-2020, 11:50 AM
  3. How do I add a selected range of value from combobox in userform?
    By Toomer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2019, 06:45 AM
  4. Commandbutton to copy range of cells as image into a Userform or Listbox
    By chrisellis250 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-26-2017, 12:39 PM
  5. commandbutton check values in combobox of another userform
    By aidda in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2015, 02:38 PM
  6. [SOLVED] Pass Value of combobox selected in Userform as input to textbox of other userform
    By Pradeepg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-29-2013, 10:32 AM
  7. Commandbutton in userform to execute code based on a previous commandbutton choice?
    By michaeljoeyeager in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2012, 03:28 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