Drop Down Menu Font Size

Gladme

New Member
Joined
Mar 8, 2018
Messages
18
Hello,

I have a VBA code for a worksheet help me to increase the window zoom when I select the drop down menu. With this code I can see the drop down menu text in appropriate font size. Here is the code:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)



Application.ScreenUpdating =False

On Error GoTo LZoom

Dim xZoom As Long

xZoom = 63

If Target.Validation.Type =xlValidateList Then xZoom = 100

LZoom:

ActiveWindow.Zoom = xZoom

Application.ScreenUpdating =False



End Sub

This code works perfect in my monitor. However, The file will be opened in different size of the monitor as well as different resolutions. For other worksheets without the dropdown menu list I have a code to define the active window based on table width. for example:

Range("A1:J1").select
ActiveWindow.zoom = true

Could you please help know if I can define a range of cells (in my VBA code for drop down menu size) instead of one zoom percentage number ?

Many thanks in advance.

Glad










 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try this:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.ScreenUpdating = False
    On Error GoTo LZoom
    Dim xZoom As Long
    xZoom = 63
    If Target.Validation.Type = xlValidateList Then
        'xZoom = 100
        Application.EnableEvents = False
        Range("A1:J1").Select
        ActiveWindow.Zoom = True
        Target.Select
        Application.EnableEvents = True
        Exit Sub
    End If
LZoom:
    ActiveWindow.Zoom = xZoom
    Application.ScreenUpdating = False
End Sub
 
Upvote 0
Thank you for your time and consideration.

It's perfect when I choose drop down list.
I want o replace xzoom=100 (when other cells are selected) with an active window of A1:Z1. could you please help me to add I t the code aswell?

Thank you
 
Upvote 0
just change this

xZoom = 63

for this

xZoom = 100

Testit
 
Upvote 0
Thanks.

I couldn't explain my question properly. I don't want to use a number like 100 or 63 for xzoom. Instead I need to define a range (A1:Z1) for the condition that drop down lists are no selected. At your first answer, you helped me to define Rage (A1:J1) for window zoom when drop down lists at selectd which solved my drop do list font size. for the other conditions I want to define Range (A1:Z1) as active window.

Thanks again and sorry for too much questions.
 
Upvote 0
Dont worry
Try this

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.ScreenUpdating = False
    On Error GoTo LZoom
    Dim xZoom As Long
    'xZoom = 100
    If Target.Validation.Type = xlValidateList Then
        'xZoom = 100
        Application.EnableEvents = False
        Range("A1:J1").Select
        ActiveWindow.Zoom = True
        Target.Select
        Application.EnableEvents = True
        Exit Sub
    End If
LZoom:
    Application.EnableEvents = False
    Range("A1:Z1").Select
    ActiveWindow.Zoom = True
    Target.Select
    Application.EnableEvents = True
    Application.ScreenUpdating = False
End Sub

Regards
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top