精华内容
下载资源
问答
  • 如何给option button分组,使得用户在选择是或者否的时候,可以二选一或者三选一,而且各个选项之间互不干扰呢。方法非常简单,只要使用groupname设置一下分组就可以了。 这里设置一下分组后,同个分组的option ...

    如何给option button分组,使得用户在选择是或者否的时候,可以二选一或者三选一,而且各个选项之间互不干扰呢。方法非常简单,只要使用groupname设置一下分组就可以了。

    这里设置一下分组后,同个分组的option button就只能选择一个了,非常方便。

    GroupName可以是数字也可以是英文,大家可以酌情取名。

    展开全文
  • VBA_控件03

    2020-06-06 23:52:51
    Sheet2.OptionButton1.Caption = "男" Sheet2.OptionButton2.Caption = "女" End Sub Sub attribute2() Sheet2.OptionButton1.Enabled = True Sheet2.OptionButton2.Enabled = True End Sub '组名 Sub attribute3() ...

    '单选按钮属性
    Sub attribute1()
    Sheet2.OptionButton1.Caption = "男"
    Sheet2.OptionButton2.Caption = "女"
    End Sub
    Sub attribute2()
    Sheet2.OptionButton1.Enabled = True
    Sheet2.OptionButton2.Enabled = True
    End Sub
    '组名
    Sub attribute3()
    Sheet2.OptionButton1.GroupName = "性别"
    Sheet2.OptionButton2.GroupName = "性别"
    End Sub
    '返回值
    Sub attribute4()
    Sheet2.Range("A1") = Sheet2.OptionButton1.Value
    Sheet2.Range("b1") = Sheet2.OptionButton2.Value
    End Sub
     

    展开全文
  • VBA生成KML文件

    2019-07-19 16:17:27
    Private Sub OptionButton36_Click() Dim i As Integer Dim s As String '存储生成的代码 Dim f As String '保存的文件名 Dim rng As Range f = ThisWorkbook.Path & “\GZ.kml” '宏所在的文件内KML文件 ...
    SUB TEST()
        Dim i As Integer
        Dim s As String '存储生成的代码
        Dim f As String '保存的文件名
        Dim rng As Range
        f = ThisWorkbook.Path & "\GZ.kml"
        s = "<kml xmlns=""http://earth.google.com/kml/2.0"">" & Chr(13) & _
            "<Folder>"
        'Set rng = Intersect(Selection, ActiveSheet.UsedRange)
        x = Application.CountA(Worksheets("结果").Range("A:A"))
        Set rng = Worksheets("结果").[A1].CurrentRegion
        If rng Is Nothing Then MsgBox "请选择合适的数据信息!": Exit Sub
        For i = 1 To x
                s = s & "<Placemark><description></description><name>" & rng(i, 1).Value & _
                        " </name><LookAt>" & _
                        "<longitude>" & rng(i, 2).Value & "</longitude>" & _
                        "<latitude>" & rng(i, 3).Value & "</latitude>" & _
                        "<range>2000</range>" & _
                        "<tilt>0</tilt>" & _
                        "<heading>3</heading>" & _
                        "</LookAt><Point>" & _
                        "<coordinates>" & rng(i, 2).Value & "," & rng(i, 3) & ",0</coordinates>" & _
                        "</Point> </Placemark>" & Chr(13)
        Next
        s = s & Chr(13) & "</Folder></kml>"
        
        SaveFile s, f ' 件,则中文名可以正常显示
        FileZM f, "GB2312", f, "UTF-8"   '转换成UTF-8编码的文件
        MsgBox "已生成!"
        END SUB
    
    展开全文
  • VBA编写的程序中,如果可以在运行时动态创建控件无疑是非常有用的,因为有些控件是...Forms.Optionbutton.1(选项按钮) Forms.Textbox.1(文本框) Forms.Listbox.1(列表框) Forms.Commandbutton.1(命令按钮)
  • Public batch$ Sub crAddReport() '获取窗体单选框选择 ... If UserForm1.OptionButton1.Value = True Then batch = "一" ElseIf UserForm1.OptionButton2.Value = True Then bat...
    Public batch$
    Sub crAddReport()
        '获取窗体单选框选择
        UserForm1.Show
        If UserForm1.OptionButton1.Value = True Then
            batch = "一"
        ElseIf UserForm1.OptionButton2.Value = True Then
            batch = "二"
        ElseIf UserForm1.OptionButton3.Value = True Then
            batch = "三"
        End If
    
        t1 = Timer
        Application.ScreenUpdating = False
            Call importLog '引用模块2的方法
            Call findBrokenStation '引用模块2的方法
            Call nowCrReport2
            Call crFile2
        Application.ScreenUpdating = True
        t2 = Timer
        MsgBox "己完成,运行时间 = " & (t2 - t1) * 1000 & " ms"
    
    End Sub
    
    Sub crFile2()
    
        Worksheets("结果统计-新增").Copy
        With ActiveSheet
            .Select
            .Columns("A:E").Delete
            .Shapes.Range(Array("Picture 1")).Delete
            [I1] = "执行结果"
            [I2] = "断X"
            [I3] = "配齐4个XX"
            [I4] = "无XX数据"
            [I5] = "因XXXX未配齐"
            [I6] = "总计"
    
            [J1] = "数量"
            [J2].formula = "=COUNTIF(E:E,I2)"
            [J3].formula = "=COUNTIF(E:E,I3)"
            [J4].formula = "=COUNTIF(E:E,I4)"
            [J5].formula = "=COUNTIF(E:E,I5)"
            [J6].formula = "=SUM(J2:J5)"
        End With
        '格式化
        Call formatting2
        '选择批次
        
        ActiveWorkbook.SaveAs "XXX测量配置结果_" & Month(Date) & "月第" & batch & "组.xlsx"
        
    End Sub
    
    Sub nowCrReport2()
        Application.ScreenUpdating = False
        Dim d As Object, rng As Range
        Set dCity = CreateObject("Scripting.Dictionary")
        Set dOSS = CreateObject("Scripting.Dictionary")
        With Worksheets("ip对应地市名工具")
        For i = 1 To .[A65536].End(xlUp).Row
            dCity.add .Cells(i, 1).Value, .Cells(i, 2).Value
            dOSS.add .Cells(i, 1).Value, .Cells(i, 3).Value
        Next
        End With
        
        Dim lRow%, leftIp$, cellsNum, freqNum%
        lRow = [A65536].End(xlUp).Row
        On Error Resume Next
        For i = 2 To lRow
            '如果Cells(i, 1).Value为空,则对应行不作处理,也为空
            If Cells(i, 1).Value <> "" Then
                leftIp = Left(Cells(i, 1).Value, 6)
                Cells(i, 6) = dCity(leftIp)
                Cells(i, 7) = Cells(i, 2) '名称
                Cells(i, 8) = Cells(i, 1) 'IP
                Cells(i, 9) = dOSS(leftIp)
                cellsNum = Cells(i, 4).Value
                freqNum = Cells(i, 5).Value
                Cells(i, 10) = addResult(cellsNum, freqNum)
                Cells(i, 11) = Cells(i, 4).Value
                Cells(i, 12) = Cells(i, 5).Value
            End If
        Next
        '此处妙,多重功能:删除A列空行,不正确IP,8.137站点
        Columns("F:F").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
        Application.ScreenUpdating = True
        
    End Sub
    
    Function addResult(cellsNum, freqNum)
        
        If cellsNum = "" Then
            addResult = "断X"
        ElseIf cellsNum = 0 Then
            addResult = "无XX数据"
        ElseIf freqNum / cellsNum = 4 Then
            addResult = "配齐4个XX"
        Else
            addResult = "因占用XX未配齐"
        End If
    
    End Function
    
    Sub formatting2()
    '    置中,加边框,上色
        Range("I1:J6").Select
        With Selection
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
        End With
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideHorizontal)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        Range("I1:J1").Select
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 5287936
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
        Range("I6:J6").Select
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .ThemeColor = xlThemeColorAccent5
            .TintAndShade = 0.599993896298105
            .PatternTintAndShade = 0
        End With
        Rows("2:6").Select
        Selection.RowHeight = 21
    
        Columns("I:J").Select
        Selection.ColumnWidth = 17.88
    
    End Sub
    
    

     

    展开全文
  • 首先,这是个很有趣的例子,可以考虑在日常工作中提醒个人事项。 代码如下: Option Explicit Private Sub CommandButton1_Click() Dim mop As Boolean '定义...Case OptionButton1 = mop '选中第一个,则
  • VBA制作DT(适用ERIC)

    2019-07-24 09:15:49
    Private Sub OptionButton37_Click() 'DT制作 Shell "cmd.exe /c DEL " & ThisWorkbook.Path & "\*.mos" Application.Wait Now + TimeValue("00:00:01") Worksheets("脚本模板").Activate X = ...
  • <p>Clicking the add new cheats button crashes VBA-M <h3>Steps to reproduce the behavior <p>Open VBA-M, loading a game, click list cheats (assuming cheats was enabled), click the add new cheats button....
  • <div><p>Hi, I downloaded Anaconda, and installed in the standard way.... button and nothing else, I am not sure if this is the supposed way)</p><p>该提问来源于开源项目:xlwings/xlwings</p></div>
  • 第十二部分 ActiveX控件一、ActiveX控件属性ActiveX控件英文名称中文名称特殊属性通用属性CommandButton命令按钮caption\enable\visibleleft\top微调按钮无caption属性Label文本框OptionButton单选按钮GroupName、...
  • Private Sub OptionButton39_Click() '提取功能 Set rs = CreateObject("adodb.Recordset") cnn.Open "Provider = Microsoft.ace.Oledb.12.0;Extended Properties =TEXT;Data Source =" & ThisWorkbook.Path &...
  • 自动生成VBA窗体菜单

    2010-08-16 15:23:46
    自动生成VBA窗体菜单 '*************************** '* 菜单类 * '*************************** Option Explicit Private WithEvents MenuBar_MenuItem As MSForms.Label '菜单项 Private WithEvents WorkForm As...
  • 一、打开 控件工具箱 office 2003-2007:视图——》工具栏——》控件工具箱 office 2010:文件——》选项...Label、CheckBox、TextBox、CommandButton、OptionButton 详解:http://www.doc88.com/p-8989047352617.htm
  • OptionButton:单选按钮Caption属性就是提示文字,Value属性True或False CheckBox:复选框Caption属性就是提示文字,Value属性True或False Frame:框架控件,带有“xyz”符号的控件 Image:图像控件,主要属性...
  • <div><p>It's handy being able to click ... button at the top of the <em>CE</em> pane with a drop down giving the various options.</p><p>该提问来源于开源项目:rubberduck-vba/Rubberduck</p></div>
  • Programming Excel with VBA and .NET Preface Part I: Learning VBA Chapter 1. Becoming an Excel Programmer Section 1.1. Why Program? Section 1.2. Record and Read Code Section 1.3. Change ...
  • 第1类:button ,option ,checkbox ,togglebutton ,分组框 一组togglebutton中会始终有一个是按下去的状态 如果是一组commandbutton就全部都始终都是弹起的状态 1.1 togglebutton 切换按钮/ 互斥按钮 1.1.1基本...
  • Option Explicit Public Declare PtrSafe Function RegisterClass Lib "user32" Alias "RegisterClassA" (Class As WNDCLASS) As Long Public Declare PtrSafe Function UnregisterClass Lib "user32" Alias ...
  • We should have an option to remove the TODO comment from within the TODO Explorer - let's add a button to the window's toolbar to do that.</p><p>该提问来源于开源项目:rubberduck-vba/...
  • Source Control option" 9. Select the "Settings" tab, and set the settings for User Name, Email Address, Default Repository Location. Click Update. 10. Click the unlabelled button, with the...
  • 2. Hit the Home button, then Game Settings, and then hit Video. Check that 'Colorize Mono GB' is set to Off; if it is, skip step 3. 3. Change that option from On to Off and then restart ...
  • I clicked the refresh button in the CE - ALL of the code except the annotation and Option Explicit were deleted! I used Undo and the stubs returned. However, each time I refresh the CE the code stubs...
  • or just go with option <strong>C)</strong> as the most useful and longest lasting (option <strong>D)</strong> goes away with the click of a button and can be quickly forgotten) <p>Of course, if the ...
  • Right now visually, it looks like a button that you push once to make the fix without being sure what the fix is going to be. <p>More optional: maybe include a number in the dropdown that indicates ...
  • <div><p>The Form includes the option to list a claimant other than the Veteran. We need a way for users to view associated relationships from the corporate database, so they can select the relevant ...
  • Multiplayer support

    2020-12-31 04:12:35
    <div><p>(I'm moving this from the comments on #22) <p>Several GBA games support multiplayer, for example: * Kirby & the Amazing Mirror * The Legend of Zelda: ...RSDuck/vba-next-switch</p></div>
  • If I enter the english version of that keys (Joy1-button1) it works until I change anything in the settings. <h3>Steps to reproduce the behavior <p>try to assign the keys. <h3>ROM details <p>Which ...
  • present in VBA-M r781, I am unsure if it is present in earlier releases of vbagx at the moment. f) In regards to the algorithm added to remove rubbish from rom titles... In my case there are is not a...
  • VBA forms. <p>However the exported modules contain all the information we need - we "just" need to parse it, and pick up the value of the <code>Name</code> property whenever it's ...
  • password access need the 'save password' option to be selected in the ADO dialogue. This is not a requirement when setting up an ADO connection via code. - Dragdrop events not functioning in .NET....

空空如也

空空如也

1 2
收藏数 35
精华内容 14
热门标签
关键字:

optionbuttonvba