位置:首頁 > 軟件操作教程 > 辦公軟件 > Excel > 問題詳情

怎么使EXCEL里數(shù)據(jù)有效性列表顯示得更大些?

提問人:周麗平發(fā)布時(shí)間:2021-07-21

在使用excel時(shí),當(dāng)使用數(shù)據(jù)有效性創(chuàng)建下拉列表時(shí),不能夠改變字體或字體大小。如果縮小工作表的尺寸,那么將難以閱讀列表中的項(xiàng)目。

                                                                             image.png

要使列表中的文本看起來更大,可以使用VBA代碼,使得在選擇數(shù)據(jù)有效性單元格時(shí)增大工作表縮放尺寸設(shè)置,從而使數(shù)據(jù)有效性列表中的文本看起來更大。

下面的代碼在選擇數(shù)據(jù)有效性列表單元格時(shí)將工作表的尺寸縮放為120%。如果選擇的單元格中沒有設(shè)置數(shù)據(jù)有效性,那么工作表尺寸縮放為100%。

                                                                         image.png

代碼

Private Sub Worksheet_SelectionChange(ByVal Target As Range)    Dim lZoom As Long
    Dim lZoomDV As Long
    Dim lDVType As Long
    lZoom = 100
    lZoomDV = 120
    lDVType = 0
 
    Application.EnableEvents = False
    On Error Resume Next
    lDVType = Target.Validation.Type     On Error GoTo errHandler    If lDVType <> 3 Then
        With ActiveWindow            If .Zoom <> lZoom Then
              .Zoom = lZoom            End If
        End With
    Else
        With ActiveWindow          If .Zoom <> lZoomDV Then
            .Zoom = lZoomDV          End If
        End With
    End If 
exitHandler:
    Application.EnableEvents = True
    Exit SuberrHandler:    GoTo exitHandlerEnd Sub

繼續(xù)查找其他問題的答案?

回復(fù)(0)
返回頂部