Tag: 消息框

excel vba复制单元格块并插入多次

我试图复制一个模板块的单元格,然后让它插入到用户select的行。 理想情况下,我想要代码复制模板块,然后下拉2行,插入块X次,其中X是用户需要块的数量。 X将是input框的结果。 然后插入每个块后,打开replace文本窗口。 如果有人可以帮助我获得现有的代码,通过input框多次插入模板块,这将是一个巨大的帮助。 如果查找和replace工作将会更好 这是我的代码到目前为止。 Sub CopyTemplate() Worksheets("HR-Cal").Activate Dim rng As Range Dim trng As Range Dim tco As String 'Use the InputBox select row to insert copied cells Set rng = Application.InputBox("select row to paste into", Default:=ActiveCell.Address, Type:=8) startrow = rng.Row ' MsgBox "row =" & startrow Range("AF2") = startrow Application.ScreenUpdating = […]

Excel VBA追踪一个单元格的值

希望有人能够帮助我。 我对VBA和编码是全新的。 这里是我的代码如下: Private Sub Workbook_Open() For Each Cell In Range("I2:I500") If Cell.Value < Date – 9 And Cell.Value <> "" Then If Cell.Font.ColorIndex <> 22 And Cell.Interior.Color <> RGB(151, 210, 86) Then MsgBox "Status 1 " & ***Cell.Address(False, False)*** Cell.Font.ColorIndex = 22 Cell.Font.Bold = True End If ElseIf Cell.Value < Date – 5 And […]

数据从工作表中拉出后,MsgBox会出现多次

我想得到一些帮助下面的代码。 我很新,但我认为这是一个简单的解决scheme,我只是无法将其他search的build议翻新到我的代码。 msgboxes工作正常,第一遍来检查文本框的值是否正确,但是当我检查一个表单的公式结果是否正确时,我得到5个消息框popup。 希望这是有道理的,让我知道,如果你有任何build议! `Private Sub SpeedCommand_Click() Dim ctl As Control If TextBox1AM180.Value > 12000 And TextBox1AM180.Value <> "" Then MsgBox "Rate Value is out of range for this boom. Ensure rate value is less than 12,000 lbs./acre", vbExclamation, "Main Bin Application Rate" Me.TextBox1AM180.SetFocus Exit Sub End If If (TextBox2AM180.Value > 120 Or TextBox2AM180.Value < […]

显示一个消息框,其中包含除了一个目录以外的所有文件的列表?

我想在excel中显示一个消息框,显示目录中所有文件的列表,如下所示: Dim StrFile As String StrFile = Dir("S:\Tasks\Tenders\" & Range("M" & ActiveCell.Row).Value & "\" & Range("Z" & ActiveCell.Row).Value & "\*.*") StrFile = Dir MsgBox StrFile 现在的问题是这只能显示出一个可能的20个文件。 我正在尝试获取消息框中列出的文件夹中的所有文件,如下所示: File 1 File 2 File 3 etc 我也有一个名为log.txt的文件,我想从列表中排除。 请有人可以告诉我最好的方法来做到这一点? 提前致谢