Border the selection cell

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
 
D

Dave Patrick

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

Thyagaraj

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
 
D

Dave Patrick

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

Thyagaraj

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
 
T

Thyagaraj

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top