Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Dear experts,
I want when a cell is selected, the font of a value inside this cell will be enlarged from point 10 to pont 12, the font colour will be changed from black to bold white and the background colour will be changed to red. Can it be done by a VBA code or any other ways? Please kindly advise. Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Enter this into the visual basic editor for your worksheet. In my example
cell C9 is the one that changes when it is activated. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Application.ActiveCell = Application.Range("C9") Then Application.ActiveCell.Font.Size = 12 Application.ActiveCell.Font.Bold = True Application.ActiveCell.Interior.ColorIndex = 3 Application.ActiveCell.Font.ColorIndex = 2 End If End Sub "Freshman" wrote: Dear experts, I want when a cell is selected, the font of a value inside this cell will be enlarged from point 10 to pont 12, the font colour will be changed from black to bold white and the background colour will be changed to red. Can it be done by a VBA code or any other ways? Please kindly advise. Thanks in advance. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Dennis,
Thanks for your code and it works perfect. However, I'm sorry that I did not ask my question clearly. I want to changed format can be restore to original format if the cell is deselected afterwards. What additional codes should be added? Please kindly advise. Sorry for trouble you on this. Best regards. "Dennis" wrote: Enter this into the visual basic editor for your worksheet. In my example cell C9 is the one that changes when it is activated. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Application.ActiveCell = Application.Range("C9") Then Application.ActiveCell.Font.Size = 12 Application.ActiveCell.Font.Bold = True Application.ActiveCell.Interior.ColorIndex = 3 Application.ActiveCell.Font.ColorIndex = 2 End If End Sub "Freshman" wrote: Dear experts, I want when a cell is selected, the font of a value inside this cell will be enlarged from point 10 to pont 12, the font colour will be changed from black to bold white and the background colour will be changed to red. Can it be done by a VBA code or any other ways? Please kindly advise. Thanks in advance. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.ActiveCell = Application.Range("C9") Then Application.ActiveCell.Font.Size = 12 Application.ActiveCell.Font.Bold = True Application.ActiveCell.Interior.ColorIndex = 3 Application.ActiveCell.Font.ColorIndex = 2 Else Application.Range("C9").Font.Size = 10 Application.Range("C9").Font.Bold = False Application.Range("C9").Interior.ColorIndex = 2 Application.Range("C9").Font.ColorIndex = 1 End If End Sub "Freshman" wrote: Hi Dennis, Thanks for your code and it works perfect. However, I'm sorry that I did not ask my question clearly. I want to changed format can be restore to original format if the cell is deselected afterwards. What additional codes should be added? Please kindly advise. Sorry for trouble you on this. Best regards. "Dennis" wrote: Enter this into the visual basic editor for your worksheet. In my example cell C9 is the one that changes when it is activated. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Application.ActiveCell = Application.Range("C9") Then Application.ActiveCell.Font.Size = 12 Application.ActiveCell.Font.Bold = True Application.ActiveCell.Interior.ColorIndex = 3 Application.ActiveCell.Font.ColorIndex = 2 End If End Sub "Freshman" wrote: Dear experts, I want when a cell is selected, the font of a value inside this cell will be enlarged from point 10 to pont 12, the font colour will be changed from black to bold white and the background colour will be changed to red. Can it be done by a VBA code or any other ways? Please kindly advise. Thanks in advance. |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Slight change to my last post to change the cell back again.
Application.Range("C9").Interior.ColorIndex = xlColorIndexNone "Freshman" wrote: Hi Dennis, Thanks for your code and it works perfect. However, I'm sorry that I did not ask my question clearly. I want to changed format can be restore to original format if the cell is deselected afterwards. What additional codes should be added? Please kindly advise. Sorry for trouble you on this. Best regards. "Dennis" wrote: Enter this into the visual basic editor for your worksheet. In my example cell C9 is the one that changes when it is activated. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Application.ActiveCell = Application.Range("C9") Then Application.ActiveCell.Font.Size = 12 Application.ActiveCell.Font.Bold = True Application.ActiveCell.Interior.ColorIndex = 3 Application.ActiveCell.Font.ColorIndex = 2 End If End Sub "Freshman" wrote: Dear experts, I want when a cell is selected, the font of a value inside this cell will be enlarged from point 10 to pont 12, the font colour will be changed from black to bold white and the background colour will be changed to red. Can it be done by a VBA code or any other ways? Please kindly advise. Thanks in advance. |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Dennis,
Thanks for your code and it works well. Thanks again. "Dennis" wrote: Slight change to my last post to change the cell back again. Application.Range("C9").Interior.ColorIndex = xlColorIndexNone "Freshman" wrote: Hi Dennis, Thanks for your code and it works perfect. However, I'm sorry that I did not ask my question clearly. I want to changed format can be restore to original format if the cell is deselected afterwards. What additional codes should be added? Please kindly advise. Sorry for trouble you on this. Best regards. "Dennis" wrote: Enter this into the visual basic editor for your worksheet. In my example cell C9 is the one that changes when it is activated. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Application.ActiveCell = Application.Range("C9") Then Application.ActiveCell.Font.Size = 12 Application.ActiveCell.Font.Bold = True Application.ActiveCell.Interior.ColorIndex = 3 Application.ActiveCell.Font.ColorIndex = 2 End If End Sub "Freshman" wrote: Dear experts, I want when a cell is selected, the font of a value inside this cell will be enlarged from point 10 to pont 12, the font colour will be changed from black to bold white and the background colour will be changed to red. Can it be done by a VBA code or any other ways? Please kindly advise. Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can selected Excel 2007 cells be changed to have more contrast? | Setting up and Configuration of Excel | |||
cell format changed when data entered | Excel Discussion (Misc queries) | |||
Cell format has suddenly changed in all new spread sheets | Excel Discussion (Misc queries) | |||
cell format refuses to be changed | Excel Discussion (Misc queries) | |||
replace one tag in content of one cell and format not changed | Excel Discussion (Misc queries) |