Tag: 运行时错误

Excel VBA:运行时错误'438'对象不支持此属性或方法

请帮助debugging:运行时错误“438”对象不支持此属性或方法 我不知道为什么我的Function ConvertToStdDateFormat(InputRange As Range)不接受范围'ThisRange' 这是我的input看起来像 201301 201401 201301 201401 201302 201402 201302 201402 201303 201403 201303 201403 201304 201404 201304 201404 201305 201405 201305 201405 下面是代码 Sub trythis() Dim ThisRange As Range Dim MonthYear_array As Variant start_date_row = 1 end_date_row = 12 With ActiveSheet Set ThisRange = .Range(Cells(start_date_row, 1), Cells(end_date_row, 2)) MonthYear_array = .Range(Cells(start_date_row, […]

运行时错误1004:无法获取Worksheet类的PivotTables属性

我录制了这个macros来更新16个图表的date范围。 但是,正如你所看到的,我得到一个运行时错误。 我已经看过与此有关的其他线程,但没有接近。 Excel上的帮助button也无济于事。 你能给些build议么? 这里是代码: ActiveSheet.ChartObjects("Chart 18").Activate ActiveChart.Axes(xlCategory).Select ActiveSheet.ChartObjects("Chart 18").Activate With ActiveSheet.PivotTables("PivotTable2").PivotFields("Date") .PivotItems("Sep-15").Visible = False .PivotItems("Aug-14").Visible = True End With

Excel VBA:第二次分配给对象variables时运行时错误“91”

我只是学习Excel VBA的学校作业。 我已经根据某些条件为某个工作表中的某个单元格分配了一个“wtCell”对象。 错误:“对象variables或块variables未设置” 我在第二次分配“wtCell”时出错 Sub AddWardData() Dim Cell As Object Dim Ward As Object Dim lngLastRow As Long ' We need to know how many rows of data are in Column J lngLastRow = 0 lngLastRow = Range("K" & Rows.Count).End(xlUp).Row ' Complex formula – just ignore the details for now Dim w As Integer […]

VBA运行时错误…但我不能点击debugging

我得到一个运行时错误,但我不能点击debugging。 我该如何debugging这个错误? “运行时错误91对象variables或未设置块”

生成运行时错误1004时更改为单元格

当我改变从字母到单元格的范围时,下面的部分开始产生运行时错误1004: 用字母: Application.SumIf(Sheets(4).Range("E:P"), _ Sheets(6).Cells(i, 1).Value2, _ Sheets(4).Range("K:K")) 没有字母: Application.SumIf( _ Sheets(4).Range(Cells(1, 5), Cells(intLstRowA, 16)), _ Sheets(6).Cells(i, 1).Value2, _ Sheets(4).Range(Cells(1, 11), Cells(intLstRowA, 11))) 它是一个更大的循环的一部分: intLstRowA = Sheets(4).Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To 9 Sheets(6).Cells(i, 2) = _ Format( _ Application.SumIf( _ Sheets(4).Range(Cells(1, 5), Cells(intLstRowA, 16)), _ Sheets(6).Cells(i, 1).Value2, _ Sheets(4).Range(Cells(1, 11), Cells(intLstRowA, 11))) _ […]

第一个VBA代码:运行时错误“1004”

我收到运行时错误,但这可能是我的问题中最less的。 这个逻辑在我的脑海中是有道理的,但我可能不会使用正确的语法或函数。 我的代码在下面有评论和“希望”: Sub Random_Points() Dim i As Integer Dim j As Integer Dim Max As Integer Dim RandomNumber As Integer Max = 100 '(Max is being multiplied by the Rnd function to provide a random number between 0-100) For i = 2 To 100 Step 1 RandomNumber = Int(Rnd * Max) ThisWorkbook.Sheets("VBA").Cells(i, 2).Value = […]

vba代码中有多个表单对象错误

我遇到了一个“运行时错误1004”的问题:应用程序定义的错误或对象定义的错误。如果if语句不能识别正在比较的对象之一,请帮助我理解我做错了什么。 Sub Enter_deposits() Sheets("Deposits").Activate Dim x As Integer Dim y As Integer For x = 4 To 21 For y = 10 To 500 If Sheets("deposits").Range(2, 4).Value = Sheets((Cells(x, 14).Value)).Range(y, 2).Value _ And Sheets((Cells(x, 14).Value)).Range(y – 1, 3) = 0 _ And Sheets("deposits").Range(x, 15).Value <> Sheets((Cells(x, 14).Value)).Range(y, 3) Then Sheets("deposits").Range(x, 15).Copy Sheets((Cells(x, 14).Value)).Range(y, 3).PasteSpecial xlPasteValues […]

VBA Application.Caller运行时错误

我在VBA中有以下代码: Sub Kontrollkästchen_KlickenSieAuf() With ThisWorkbook.Sheets("Hinterlegungsmatrix Auswahl") Dim i, j, rowx, columnx As Integer rowx = Application.Caller.row 'I got here the run time error (object required)–>.row doesn't work columnx = Application.Caller.column 'I got here the run time error (object required)–>.column doesn't work If Worksheets("Hinterlegungsmatrix Auswahl").Cells(rowx, columnx).Value = True Then For i = 6 To 22 For […]

运行时错误424开始时没有警告

我知道还有很多类似的问题,但没有一个能够帮助我解决具体的问题。 我一直在教自己的VBA,并从http://www.excel-easy.com/vba/userform.html开始学习用户表单 一切工作正常和花花公子,直到蓝色,我收到了424错误代码,当我试图运行我的用户窗体后做了一些调整 Private Sub CommandButton21_Click() StartUpUserForm.Show End Sub 是目前这个非工作版本,但我有双重和三重检查,正确调用了用户窗体,删除并重新创buildbutton六次,重命名和召回了代码中的用户窗体,绝对没有什么帮助。 当前的用户表单是 Private Sub Userform_initialize() 'Empty NameTextBox NameTextBox.Value = "" 'Empty Race_Select Race_Select.Clear 'Fill Race_Select With Race_Select .AddItem "Dwarf" .AddItem "Elf" .AddItem "Gnome" .AddItem "Half-Elf" .AddItem "Half-Orc" .AddItem "Halfling" .AddItem "Human" .AddItem "Other" End With 'Empty Class_Select Class_Select.Clear 'Fill Class_Select With Class_Select .AddItem "Barbarian" .AddItem "Bard" […]

运行时错误在VBAmacros

我正在使用VBA代码从Outlook电子邮件中获取文本,并将其放在我设置的Excel工作表中。 我正在使用Excel 2010.我的电子邮件包含以下信息: 公司:ABC公司 课程时间:2013-10-29至2014-10-22 我已经设置了一个For With循环来通过电子邮件并在A列中插入公司名称,第一个date(2013-10-29)在B列,另一个date(2014-10-22)在列中C.当我运行我的代码时,我收到一个错误,指出:运行时错误5:无效的过程调用或参数在下面的代码行: vText2 = Trim(M.SubMatches(2)) 请你让我知道我做错了什么。 我的部分代码如下。 让我知道是否需要提供任何其他信息。 sText = olItem.Body Set Reg1 = CreateObject("VBScript.RegExp") For i = 1 To 3 With Reg1 Select Case i Case 1 .Pattern(Company\s[:]+\s(\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*)\n)" .Global = False Case 2 .Pattern = "(Class Period\s*[:]+\s*([\d-\s]*))" .Global = False Case 3 .Pattern = "(through+\s*([\d-\s]*))" .Global = False End […]