• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

if cell select then display the value bold and color change

Nitesh Khot

Member
Hi.....

Attached herewith file.
please help me describe how to do?
If i select any cell in sheet1 the cell to be display highlight , value display bold and background color pink.

Is this possible,

Waiting for your reply.

Regards,
NItesh K
 

Attachments

  • Check Post Details.xlsx
    11.2 KB · Views: 3
Hi,

Save the workbook as macro enabled workbook.

Insert this code in sheet1.
If you want some other color, please change the ColorIndex number

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

ActiveCell.Font.Bold = True

ActiveCell.Interior.ColorIndex = 7

End Sub
 
Tnks for prompt response.
One thing is that , I want only one cell...if i click another cell then before clicked cell should be there same as like other cell and only active cell highlight.
 
Check this...

Code:
Option Explicit


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
    With Cells.CurrentRegion
        .Interior.ColorIndex = 0
        .Font.Bold = False
        .Borders.Color = 0
    End With

    If IsEmpty(Target) Then Exit Sub
   
    With Target
        .Interior.ColorIndex = 7
        .Font.Bold = True
        .Borders.Color = 44
    End With
Application.ScreenUpdating = True
End Sub
 
It will not remove color if the data is not contiguous and user uses mouse to change cells.

safer will be:
Code:
With Cells.CurrentRegion

to
Code:
With Cells
 
In the scenario code will something like..

Code:
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
    With Cells
        .Interior.ColorIndex = 0
        .Font.Bold = False
    End With

    If IsEmpty(Target) Then Exit Sub
   
    With Target
        .Interior.ColorIndex = 7
        .Font.Bold = True
    End With
Application.ScreenUpdating = True
End Sub
 
Back
Top