VBA Function to Increase the Selected Cell Font.

S

Shazi

Hi,

I made one telephone directory in Sheet1, all cells are set to
Arial=10 size.

but I want to increase font size when I click on the phone number in
any cell for easy viewing. if its possible. pls send me the worksheet
event for that.

Best regards.


Shahzad Zafar
Madinah
 
P

Per Jessen

Hi

The code below enlarge the selected cell in column A. Change the column
number as desired.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Columns(1).Font.Size = 10

If Target.Column = 1 Then
Target.Font.Size = 15
End If
End Sub

Regards
Per
 
C

Charlie

Sometime users foil things with a range selection of more than one cell

If Target.Count = 1 And Target.Column = 1 Then
....
 
S

Shazi

Hi

The code below enlarge the selected cell in column A. Change the column
number as desired.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Columns(1).Font.Size = 10

If Target.Column = 1 Then
    Target.Font.Size = 15
End If
End Sub

Regards
Per

"Shazi" <[email protected]> skrev i meddelelsen









- Show quoted text -

Hi,

Thanks for reply, I want to use the same function for more than one
column,
I mean how I can apply the same function From Column A to Z.

currently I am able to zoom the cell value in A column, I have data in
the sheet from Col A to Column H.

what to do now, pls help

Regards

Shahzad
 
P

Per Jessen

Hi Shahzad

This should do it:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim TargetRange As Range
Dim isect

Set TargetRange = Range("A:Z")
Set isect = Intersect(Target, TargetRange)

If Not isect Is Nothing Then
Columns("A:Z").Font.Size = 10
Target.Font.Size = 15
End If
End Sub

Regards,
Per

"Shazi" <[email protected]> skrev i meddelelsen
Hi

The code below enlarge the selected cell in column A. Change the column
number as desired.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Columns(1).Font.Size = 10

If Target.Column = 1 Then
Target.Font.Size = 15
End If
End Sub

Regards
Per

"Shazi" <[email protected]> skrev i
meddelelsen









- Show quoted text -

Hi,

Thanks for reply, I want to use the same function for more than one
column,
I mean how I can apply the same function From Column A to Z.

currently I am able to zoom the cell value in A column, I have data in
the sheet from Col A to Column H.

what to do now, pls help

Regards

Shahzad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top