+ 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 Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,154

    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 Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,154

    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)

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