ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Border around problem (https://www.excelbanter.com/excel-programming/423214-border-around-problem.html)

AJ

Border around problem
 
I have the following code to hide pages in a worksheet so they don't print
when not needed. If I leave the With Activecell.borderaround code out, for
some reason unknown to me, the border around the active cell disappears.
WHen I put the code in some computers get a RUntime error on the code. I
have checked, we all have SP3 and we all have the same add-ins. Does anyone
have thoughts on correction to this problem?

Thank you,

Private Sub Worksheet_SelectionChange(ByVal target As Range)

If Cells(1, 13) = True Then
Worksheets("Printing MBR").Rows("8:66").EntireRow.Hidden = True
Else
Worksheets("Printing MBR").Rows("8:66").EntireRow.Hidden = False
End If

If Cells(2, 13) = True Then
Worksheets("Printing MBR").Rows("67:125").EntireRow.Hidden = True
Else
Worksheets("Printing MBR").Rows("67:125").EntireRow.Hidden = False
End If

If Cells(3, 13) = True Then
Worksheets("Printing MBR").Rows("126:185").EntireRow.Hidden = True
Else
Worksheets("Printing MBR").Rows("126:185").EntireRow.Hidden = False
End If

With ActiveCell.BorderAround
End With


End Sub

JLGWhiz

Border around problem
 


With ActiveCell
.BorderAround LineStyle:=xlContinuous
End With



"AJ" wrote:

I have the following code to hide pages in a worksheet so they don't print
when not needed. If I leave the With Activecell.borderaround code out, for
some reason unknown to me, the border around the active cell disappears.
WHen I put the code in some computers get a RUntime error on the code. I
have checked, we all have SP3 and we all have the same add-ins. Does anyone
have thoughts on correction to this problem?

Thank you,

Private Sub Worksheet_SelectionChange(ByVal target As Range)

If Cells(1, 13) = True Then
Worksheets("Printing MBR").Rows("8:66").EntireRow.Hidden = True
Else
Worksheets("Printing MBR").Rows("8:66").EntireRow.Hidden = False
End If

If Cells(2, 13) = True Then
Worksheets("Printing MBR").Rows("67:125").EntireRow.Hidden = True
Else
Worksheets("Printing MBR").Rows("67:125").EntireRow.Hidden = False
End If

If Cells(3, 13) = True Then
Worksheets("Printing MBR").Rows("126:185").EntireRow.Hidden = True
Else
Worksheets("Printing MBR").Rows("126:185").EntireRow.Hidden = False
End If

With ActiveCell.BorderAround
End With


End Sub



All times are GMT +1. The time now is 09:51 AM.

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