Draw a border by a command button

girapas

Board Regular
Joined
Apr 20, 2004
Messages
150
1) I need to make a command button in an Excel XP sheet. When the user clicks the button a border with a specific style will be drawn on the current cell.
2) Next, I want that border to be drawn automatically in another cell (same row, different column).
Thanks in advance
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
The code for applying the borders can be recorded, but you would still need to edit the code to do what you want, otherwise.

What is the other cell that should be formatted? Will it always be a certain number of columns to the right/left of the selected cell or will it always be a specific column?
 
Upvote 0
How's this for a start:

<font face=tahoma><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> CommandButton1_Click()
    <SPAN style="color:#00007F">With</SPAN> ActiveCell
        .BorderAround ColorIndex:=3, Weight:=xlThick
        .Offset(, 2).BorderAround ColorIndex:=3, Weight:=xlThick
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Hope that helps,

Smitty
 
Upvote 0
For Von Pookie:
The first cell, where user will draw the border clicking the button, can be anywhere. The other cell is a certain number of columns to the right.
 
Upvote 0

Forum statistics

Threads
1,225,072
Messages
6,182,698
Members
453,132
Latest member
nsnodgrass73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top