ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   command button (https://www.excelbanter.com/excel-programming/367482-command-button.html)

saziz[_79_]

command button
 

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


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=562276


Leith Ross[_664_]

command button
 

Hello Saziz,

Here is an example using a command button named CommandButton1. You ca
change this to match your command buttons. The Range is on Sheet1, cell
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 Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=56227



All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com