+ Reply to Thread
Results 1 to 4 of 4

If statement links to Command Button in a Form

  1. #1
    Registered User
    Join Date
    01-18-2019
    Location
    New York
    MS-Off Ver
    Office 365
    Posts
    3

    If statement links to Command Button in a Form

    I am trying to get a portion of code to execute when a user clicks on a command button. I think using an If Statement would be the easiest way to do it, but I am unsure.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: If statement links to Command Button in a Form

    If the CommandButton is on a userform, or from the ActiveX menu, you can use the CommandButton_Click event.
    If it is from the Forms menu, you can assign a macro to that control.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    01-18-2019
    Location
    New York
    MS-Off Ver
    Office 365
    Posts
    3

    Re: If statement links to Command Button in a Form

    Thanks for your input,

    So what I am trying to do is upload information I collected using the form onto a spreadsheet. I want each batch of information to be uploaded when the user hits the command button "upload". Where I am struggling is getting it to move to the next row for the next batch of information. I keep getting caught in infinite do loops, so I am looking into doing an if statement that will upload the info every time the button is clicked, row by row.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: If statement links to Command Button in a Form

    Is the CommandButton on a userform, ActiveX or from the Forms menu.

    Upload the information to the Web? or write it to a worksheet?

    To write to the line after the last filled line in column A, I would use code like this. No looping, or If statement, is needed

    Please Login or Register  to view this content.

+ 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. Command Button in Opening Links
    By bambino86 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2017, 02:16 AM
  2. how to add url links to listbox using command button
    By biznez1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2013, 12:26 PM
  3. [SOLVED] How to make a Command button run the "FORM" command to fill/populate a table?
    By jrobin7 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-21-2012, 12:26 PM
  4. Form - Command Button
    By shugg24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2010, 09:28 AM
  5. Command Button Links
    By jespvik in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-28-2009, 09:36 AM
  6. Form Command Button Problem..
    By Don in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2006, 09:20 PM
  7. VB's Command Button vs Form's Command Button
    By Ronald Dodge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2006, 09:30 AM

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