LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Change Text size on focus

I will check these out to see which is most usefull, initial testing seems to
work for each submission.

Thanks for your help!

--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"sebastienm" wrote:

Hi,
Method1
---------
Resizing the font may (will) resize the column width and the row height, so
it may create more issues than good. ANyway, the code bellow works ok.

Method2
---------
A less invasive solution would be to have a picture of the cell next to the
selected cell that show its contents in larger font.
- select an empty cell and do a Copy Picture (in xl 2003 and prior, press
SHIFT while clicking menu Edit and the new item Copy Picture shows up) as
bitmap.
- paste the picture (menu Edit Paste). Say its name is 'Picture 1'
- enlarge it a little bit
- now in the sheet module, use the code (uses the name of the picture):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim p As Excel.Picture
Set p = ActiveSheet.Pictures("picture 1")
p.Formula = "=" & ActiveCell.Address(False, False)
End Sub
- On book closing, you could just hide the picture.

Method1 - COde
-------------------
''' ########## IN SHEET ######################
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ResetToPrevious
SetTracker ActiveCell
End Sub

''' ########## IN MODULE ######################
Public Type Tracker
Range As Range
RowHeight As Double
ColumnWidth As Double
FontSize As Single
End Type

Public mPrevious As Tracker

Public Sub ResetToPrevious()
If Not mPrevious.Range Is Nothing Then ''' reset previous range if any
With mPrevious
.Range.Font.Size = .FontSize
.Range.ColumnWidth = .ColumnWidth
.Range.RowHeight = .RowHeight

Set .Range = Nothing
End With
End If
End Sub

Public Sub SetTracker(Target As Range, Optional Size As Long = 24)
Dim cell As Range
Set cell = Target.Cells(1)
With mPrevious
Set .Range = cell
.ColumnWidth = cell.ColumnWidth
.RowHeight = cell.RowHeight
.FontSize = Size

.Range.Font.Size = Size
End With

End Sub
''' #####################################
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
<http://www.ready-reports.com


"Rick S." wrote:

Is it possible to change the text size when a cell is selected? I would like
to simulate magnifying the cell contents when a cell is progmatically
selected to draw user attention to the cell.
Upon leaving that cell the font size would revert to default (its originial
format value).

Happy New Year!
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

 
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
How do I change the size of the text in a worksheet tab? Doug New Users to Excel 2 December 22nd 08 07:14 PM
Text formatting - Change Font Size dd Excel Programming 5 February 2nd 07 10:25 AM
Change the size of text used in a Form combo box Mark Excel Discussion (Misc queries) 0 April 11th 06 03:08 PM
font size changes w/ control focus mark kubicki Excel Worksheet Functions 0 June 17th 05 06:00 PM
How do I change the text size in a drop down box Paragon Tim Excel Discussion (Misc queries) 0 April 7th 05 07:51 PM


All times are GMT +1. The time now is 11:24 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"