Border Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Guest
Hello, this is for the same project as the "This Workbook" Macro problem from earlier. THIS problem involves the code near the bottom - Selection Columns A:A. What I am trying to get it to do is when the row is pasted, I want it to past the left border of Column A. It worked yesterday, and today it doesn't work! What I also cannot for the life of me work out is how do I paste the BOTTOM border of Column A as well. In actual fact what I want is only the LAST bottom border, so the square border around the doc is intact, instad of it going all the way around and then the bottom of column A is missing it's bottom border.

This code is probably a God-forsaken mess. I have no idea what I'm doing but it is slowly getting there. In case it matters, Column A has a coloured fill which remains when it's pasted

Here's the code:

Dim shtOriginal As String
Application.ScreenUpdating = False
shtOriginal = ActiveSheet.Name
ActiveCell.Rows("1:1").EntireRow.Select
Selection.Copy
Sheets("My Class").Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
With Selection.Font
.Name = "Arial"
.Size = 9
.ColorIndex = 0
End With
Selection.Columns("D:AF").Select
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Columns("A:A").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
ActiveCell.Offset(0, -3).Range("A1").Select
Sheets(shtOriginal).Select
ActiveCell.Offset(1, 1).Activate
Application.ScreenUpdating = True
End Sub

Thank you to everyone who has helped in anyway to get it this far. YOu are all bloody fantastic!!!

Cheers!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,223,375
Messages
6,171,707
Members
452,418
Latest member
kennettz

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