ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Border the selection cell (https://www.excelbanter.com/excel-programming/368856-border-selection-cell.html)

Thyagaraj

Border the selection cell
 
Hi All,

Is there any vba code for bordering the entire row and entire column of
the cell selected and remove border when the cell is changed.

ie.,
1 - When i select a cell on the worksheet the entire row and entire
column should be highlited by a border.
2 - When the selection is changed the border of the previous cells row
and column should and activecells row and column should be bordered.

If any problem in understanding please revert back.


Regards
A


Dave Patrick

Border the selection cell
 
You could always record a macro of both operations. Then Alt-F11 and look at
what code was recorded.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Thyagaraj" wrote:
| Hi All,
|
| Is there any vba code for bordering the entire row and entire column of
| the cell selected and remove border when the cell is changed.
|
| ie.,
| 1 - When i select a cell on the worksheet the entire row and entire
| column should be highlited by a border.
| 2 - When the selection is changed the border of the previous cells row
| and column should and activecells row and column should be bordered.
|
| If any problem in understanding please revert back.
|
|
| Regards
| A
|



Thyagaraj

Border the selection cell
 

Dave Patrick wrote:
You could always record a macro of both operations. Then Alt-F11 and look at
what code was recorded.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Thyagaraj" wrote:
| Hi All,
|
| Is there any vba code for bordering the entire row and entire column of
| the cell selected and remove border when the cell is changed.
|
| ie.,
| 1 - When i select a cell on the worksheet the entire row and entire
| column should be highlited by a border.
| 2 - When the selection is changed the border of the previous cells row
| and column should and activecells row and column should be bordered.
|
| If any problem in understanding please revert back.
|
|
| Regards
| A
|Dear Patrick,


I know the code to get border and remove the border but this should
happen when ever the cell is changed how is this possible........?

Any suggesions please


Regards
A


Dave Patrick

Border the selection cell
 
Add your code to something like this.

Dim OldRange As Range

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Set OldRange = Selection
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
With OldRange
.Interior.ColorIndex = xlNone
End With
With Target
.Interior.ColorIndex = 46
.Interior.Pattern = xlSolid
End With
Set OldRange = Target
End Sub

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Thyagaraj" wrote:
| I know the code to get border and remove the border but this should
| happen when ever the cell is changed how is this possible........?
|
| Any suggesions please
|
|
| Regards
| A
|



Thyagaraj

Border the selection cell
 

Dave Patrick wrote:
Add your code to something like this.

Dim OldRange As Range

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Set OldRange = Selection
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
With OldRange
.Interior.ColorIndex = xlNone
End With
With Target
.Interior.ColorIndex = 46
.Interior.Pattern = xlSolid
End With
Set OldRange = Target
End Sub

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Thyagaraj" wrote:
| I know the code to get border and remove the border but this should
| happen when ever the cell is changed how is this possible........?
|
| Any suggesions please
|
|
| Regards
| A
|

Dear Dave Patrick ,

Thanks


Reg
A


Thyagaraj

Border the selection cell
 

Dave Patrick wrote:
Add your code to something like this.

Dim OldRange As Range

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Set OldRange = Selection
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
With OldRange
.Interior.ColorIndex = xlNone
End With
With Target
.Interior.ColorIndex = 46
.Interior.Pattern = xlSolid
End With
Set OldRange = Target
End Sub

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Thyagaraj" wrote:
| I know the code to get border and remove the border but this should
| happen when ever the cell is changed how is this possible........?
|
| Any suggesions please
|
|
| Regards
| A
|

Dear Dave Patrick ,

Thanks


Reg
A


Dave Patrick

Border the selection cell
 
You're welcome.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Thyagaraj" wrote:
| Dear Dave Patrick ,
|
| Thanks
|
|
| Reg
| A
|




All times are GMT +1. The time now is 07:53 AM.

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