Border the selection cell

  • Thread starter Thread starter Thyagaraj
  • Start date Start date
T

Thyagaraj

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
 
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

:
| 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 said:
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

:
| 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
 
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

:
| 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 said:
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

:
| 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 said:
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

:
| 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
 
Back
Top