Format Painter - Macro

spyldbrat

Board Regular
Joined
May 5, 2002
Messages
200
Office Version
  1. 365
I have to create borders on a worksheet. The number of rows in my spreadsheet will vary with each use (can be more or less than the last time used). I am not the end user so I was hoping I could use format painter while recording a macro but that didn't seem to work? Is there another way around this?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
10,307
It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 

spyldbrat

Board Regular
Joined
May 5, 2002
Messages
200
Office Version
  1. 365
I am looking to have the blue border in between H & I and O & P copy down to the last row of data. The last row will change each time the spreadsheet is used.


1600274113280.png
 

Attachments

  • 1600274027712.png
    1600274027712.png
    46 KB · Views: 1

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,729
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Sub spyldbrat()
   With Range("H" & Rows.Count).End(xlUp)
      With Range("H1:H" & .Row & ",O1:O" & .Row).Borders(xlEdgeRight)
         .Color = vbBlue
         .Weight = xlThick
      End With
   End With
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,129,942
Messages
5,639,108
Members
417,072
Latest member
JaimeDee

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
Top