Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Format changed when the cell selected

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 202
Default Format changed when the cell selected

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Format changed when the cell selected

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 202
Default Format changed when the cell selected

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 202
Default Format changed when the cell selected

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Format changed when the cell selected

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can selected Excel 2007 cells be changed to have more contrast? Bob J H Setting up and Configuration of Excel 3 June 3rd 08 05:14 PM
cell format changed when data entered John Keith Excel Discussion (Misc queries) 1 September 14th 07 06:04 AM
Cell format has suddenly changed in all new spread sheets Andy Excel Discussion (Misc queries) 5 October 29th 06 08:16 AM
cell format refuses to be changed Alyssa Excel Discussion (Misc queries) 5 July 21st 06 10:27 AM
replace one tag in content of one cell and format not changed replace one tag in content of one cell a Excel Discussion (Misc queries) 1 January 9th 06 03:36 PM


All times are GMT +1. The time now is 05:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"