+ Reply to Thread
Results 1 to 2 of 2

command button:How can I write a code to put a set of data in a particular range

  1. #1
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    Posts
    198

    command button:How can I write a code to put a set of data in a particular range

    I created 2 command button on user form. How can I write a code to put a set of data in a particular range if a button1 is clicked and simillarly into a different range if button2 is clicked.
    Appreciate your help.

    Thank you
    Syed

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,255
    Hello Saziz,

    Here is an example using a command button named CommandButton1. You can change this to match your command buttons. The Range is on Sheet1, cells A1 to A3. Be sure to change these to match your code also.

    Sub CommandButton1_Click()
    With Worksheets("Sheet1")
    .Cells(1, "A").Value = "A"
    .Cells(2, "A").Value = "B"
    .Cells(3, "A").Value = "C"
    End With
    End Sub

    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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