Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Selected Cell Problem


Dear All,

I am using the below worksheet event to increase the Selected Font
Size and to change the Interior Color (background color).

This procedure is working fine, but there is a small problem, its
removing all Filled Color area from (background area) and making Font
10 in all sheet.

I want a procedure to change the Font Size and Back color only in the
selected cell. rest of the sheet will remain same formatting.

If its possible pls send me reply.

My procedure is given below.

'+++++++++++++++++++++++++++++++++++++++++++++++++ ++++
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.ScreenUpdating = False

Cells.Interior.ColorIndex = xlNone
Cells.Font.Size = 10
Target.Interior.ColorIndex = 8

With Selection.Font
.Name = "Arial"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

Application.ScreenUpdating = True

End Sub

'++++++++++++++++++++++++++++++++++++++++++++

Thanks and regards.

Shahzad Zafar
Madinah
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Selected Cell Problem

I answered this in a post to you yesterday.........
Public lastcell
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'MsgBox lastcell
On Error Resume Next
With Range(lastcell)
.Interior.ColorIndex = xlNone
.Font.Size = 10
End With

With Target
.Font.Size = 18
.Interior.ColorIndex = 8
End With

lastcell = Target.Address
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Shazi" wrote in message
...

Dear All,

I am using the below worksheet event to increase the Selected Font
Size and to change the Interior Color (background color).

This procedure is working fine, but there is a small problem, its
removing all Filled Color area from (background area) and making Font
10 in all sheet.

I want a procedure to change the Font Size and Back color only in the
selected cell. rest of the sheet will remain same formatting.

If its possible pls send me reply.

My procedure is given below.

'+++++++++++++++++++++++++++++++++++++++++++++++++ ++++
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.ScreenUpdating = False

Cells.Interior.ColorIndex = xlNone
Cells.Font.Size = 10
Target.Interior.ColorIndex = 8

With Selection.Font
.Name = "Arial"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

Application.ScreenUpdating = True

End Sub

'++++++++++++++++++++++++++++++++++++++++++++

Thanks and regards.

Shahzad Zafar
Madinah


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Selected Cell Problem

These two lines of your code remove the background color and set the Font
size to 10 for all cells on the active sheet.

Cells.Interior.ColorIndex = xlNone
Cells.Font.Size = 10

If you delete these two lines, your problem will go away.

"Shazi" wrote:


Dear All,

I am using the below worksheet event to increase the Selected Font
Size and to change the Interior Color (background color).

This procedure is working fine, but there is a small problem, its
removing all Filled Color area from (background area) and making Font
10 in all sheet.

I want a procedure to change the Font Size and Back color only in the
selected cell. rest of the sheet will remain same formatting.

If its possible pls send me reply.

My procedure is given below.

'+++++++++++++++++++++++++++++++++++++++++++++++++ ++++
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.ScreenUpdating = False

Cells.Interior.ColorIndex = xlNone
Cells.Font.Size = 10
Target.Interior.ColorIndex = 8

With Selection.Font
.Name = "Arial"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

Application.ScreenUpdating = True

End Sub

'++++++++++++++++++++++++++++++++++++++++++++

Thanks and regards.

Shahzad Zafar
Madinah

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Selected Cell Problem

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldCell As Range
If Application.CutCopyMode = 0 Then
Application.ScreenUpdating = False
Set OldCell = Target
With OldCell
.Interior.ColorIndex = 8
.Font.Size = 20
.Font.Name = "Arial"
End With
Application.ScreenUpdating = True
End If
End Sub


Gord Dibben MS Excel MVP

On Sat, 12 Jul 2008 08:33:42 -0700 (PDT), Shazi wrote:


Dear All,

I am using the below worksheet event to increase the Selected Font
Size and to change the Interior Color (background color).

This procedure is working fine, but there is a small problem, its
removing all Filled Color area from (background area) and making Font
10 in all sheet.

I want a procedure to change the Font Size and Back color only in the
selected cell. rest of the sheet will remain same formatting.

If its possible pls send me reply.

My procedure is given below.

'++++++++++++++++++++++++++++++++++++++++++++++++ +++++
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.ScreenUpdating = False

Cells.Interior.ColorIndex = xlNone
Cells.Font.Size = 10
Target.Interior.ColorIndex = 8

With Selection.Font
.Name = "Arial"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

Application.ScreenUpdating = True

End Sub

'++++++++++++++++++++++++++++++++++++++++++++

Thanks and regards.

Shahzad Zafar
Madinah


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selected Cell Problem

I think this code will do what you are looking for...

Dim LastFontSize As Long
Dim LastColorIndex As Long
Dim LastVisitedCell As String

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
If Len(LastVisitedCell) 0 Then
Range(LastVisitedCell).Interior.ColorIndex = LastColorIndex
Range(LastVisitedCell).Font.Size = LastFontSize
End If
LastColorIndex = Target.Interior.ColorIndex
LastFontSize = Target.Font.Size
Target.Interior.ColorIndex = 8
With Selection.Font
.Name = "Arial"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Application.ScreenUpdating = True
LastVisitedCell = Target.Address
End Sub

Rick


"Shazi" wrote in message
...

Dear All,

I am using the below worksheet event to increase the Selected Font
Size and to change the Interior Color (background color).

This procedure is working fine, but there is a small problem, its
removing all Filled Color area from (background area) and making Font
10 in all sheet.

I want a procedure to change the Font Size and Back color only in the
selected cell. rest of the sheet will remain same formatting.

If its possible pls send me reply.

My procedure is given below.

'+++++++++++++++++++++++++++++++++++++++++++++++++ ++++
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.ScreenUpdating = False

Cells.Interior.ColorIndex = xlNone
Cells.Font.Size = 10
Target.Interior.ColorIndex = 8

With Selection.Font
.Name = "Arial"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

Application.ScreenUpdating = True

End Sub

'++++++++++++++++++++++++++++++++++++++++++++

Thanks and regards.

Shahzad Zafar
Madinah




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Selected Cell Problem

On Jul 12, 7:12*pm, "Rick Rothstein \(MVP - VB\)"
wrote:
I think this code will do what you are looking for...

Dim LastFontSize As Long
Dim LastColorIndex As Long
Dim LastVisitedCell As String

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
* Application.ScreenUpdating = False
* If Len(LastVisitedCell) 0 Then
* * Range(LastVisitedCell).Interior.ColorIndex = LastColorIndex
* * Range(LastVisitedCell).Font.Size = LastFontSize
* End If
* LastColorIndex = Target.Interior.ColorIndex
* LastFontSize = Target.Font.Size
* Target.Interior.ColorIndex = 8
* With Selection.Font
* * .Name = "Arial"
* * .Size = 20
* * .Strikethrough = False
* * .Superscript = False
* * .Subscript = False
* * .OutlineFont = False
* * .Shadow = False
* * .Underline = xlUnderlineStyleNone
* * .ColorIndex = xlAutomatic
* End With
* Application.ScreenUpdating = True
* LastVisitedCell = Target.Address
End Sub

Rick

"Shazi" wrote in message

...





Dear All,


I am using the below worksheet event to increase the Selected Font
Size and to change the Interior Color (background color).


This procedure is working fine, but there is a small problem, its
removing all Filled Color area from (background area) and making Font
10 in all sheet.


I want a procedure to change the Font Size and Back color only in the
selected cell. rest of the sheet will remain same formatting.


If its possible pls send me reply.


My procedure is given below.


'+++++++++++++++++++++++++++++++++++++++++++++++++ ++++
Private Sub Worksheet_SelectionChange(ByVal Target As Range)


Application.ScreenUpdating = False


* *Cells.Interior.ColorIndex = xlNone
* *Cells.Font.Size = 10
* *Target.Interior.ColorIndex = 8


With Selection.Font
* * * *.Name = "Arial"
* * * *.Size = 20
* * * *.Strikethrough = False
* * * *.Superscript = False
* * * *.Subscript = False
* * * *.OutlineFont = False
* * * *.Shadow = False
* * * *.Underline = xlUnderlineStyleNone
* * * *.ColorIndex = xlAutomatic
* *End With


Application.ScreenUpdating = True


End Sub


'++++++++++++++++++++++++++++++++++++++++++++


Thanks and regards.


Shahzad Zafar
Madinah- Hide quoted text -


- Show quoted text -


Dear All,

Thank you very much for your continious support specially to Mr. Rick.
Now I got the solution of my problem exactly what I want.

Once again thank you for taking time for me to solve my problem.

by the way Mr. Rick I am using your procedure in my project.

with best regards.

Syed Shahzad Zafar
Madinah
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
Multiple cells or columns are selected instead of selected cell or Mikey Excel Discussion (Misc queries) 1 April 29th 09 09:48 PM
Excel 2003 print problem with conditional formatting cell selected MarkGerritsen Excel Discussion (Misc queries) 1 March 22nd 06 02:48 PM
Macro to take selected cells times a selected cell Craig Excel Programming 4 October 24th 05 12:54 AM
how read value from last selected cell? It is possible? how get adress last selected cell? Andrzej New Users to Excel 4 May 30th 05 07:28 PM
how read value from last selected cell? It is possible? how get adress last selected cell? Andrzej Excel Programming 1 May 30th 05 06:18 PM


All times are GMT +1. The time now is 08:31 AM.

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

About Us

"It's about Microsoft Excel"