+ Reply to Thread
Results 1 to 4 of 4

command button

  1. #1
    Registered User
    Join Date
    09-06-2012
    Location
    asd
    MS-Off Ver
    Excel 2003
    Posts
    2

    command button

    How to develop code that when I click the ok button, then the data will send to different two sheet?

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: command button

    Can you be more specific?

    Where / what is the data? Where is the button? When you say "sent to different two sheet" do you mean the same value copied into two separate cells on different worksheets, in the same workbook?

    Please explain your requirements clearly. Attach a workbook if possible, showing exactly what your desired outcome looks like.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    09-06-2012
    Location
    asd
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: command button

    13-2-2014 3-21-45 PM.jpg

    Private Sub OKButton_Click()

    Dim emptyRow As Long

    'Make Sheet1 active
    Sheet1.Activate

    'Determine emptyRow
    emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1

    'Transfer information

    Cells(emptyRow, 3).Value = Ce.Value
    Cells(emptyRow, 2).Value = Date
    Cells(emptyRow, 5).Value = PhoneTextBox.Value
    Cells(emptyRow, 7).Value = ComboBox1.Value
    Cells(emptyRow, 6).Value = casetype.Value
    Cells(emptyRow, 4).Value = DinnerComboBox.Value
    Cells(emptyRow, 1).Value = qe.Value



    If PosteriorOptionButton1.Value = True Then
    Cells(emptyRow, 8).Value = "Major"
    Else
    Cells(emptyRow, 8).Value = "Minor"
    End If

    Cells(emptyRow, 9).Value = MoneyTextBox.Value

    End Sub


    Sorry for lack of information.. This is the screenshot and the code behind. What code I should add in in order to have that kind of effect?

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: command button

    Please wrap CODE tags around any code you post.

    It's also much easier to work with an attached workbook, rather than a JPG.


    You need to assign two 'last row' variables, one for each sheet, and qualify the destination cells with the appropriate worksheet - for example:

    Please Login or Register  to view this content.
    You should get the idea, and be able to complete your code based on this example...

+ 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. Create a command button with code with a command button
    By jakara in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 01:28 PM
  2. Code for a master command button to change the backcolor of multiple command buttons?
    By panttherm5 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2012, 10:11 PM
  3. [SOLVED] vba code, command bar, command bar button, one button works but not two
    By amazingg64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2012, 09:55 AM
  4. Replies: 1
    Last Post: 09-17-2007, 09:57 PM
  5. [SOLVED] command button:Can i use a command button to open diffrrent sheets
    By Hellboy in forum Excel General
    Replies: 0
    Last Post: 11-03-2005, 11:00 AM

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