gpt4 book ai didi

vba - Excel工作表运行时错误13 : Type mismatch.

转载 作者:行者123 更新时间:2023-12-03 03:37:43 28 4
gpt4 key购买 nike

Sub Reset_Bet()
Application.ScreenUpdating = False
Sheets("Bet Angel").Select
Range( _
"O6,O9,O11,O13,O15,O17,O19,O21,O23,O25,O27,O29,O31,O33,O35,O37,O39,O41,O43,O45,O47,O49,O51,O53,O55,O57,O59,O61,O63,O65,O67").Activate
Selection.ClearContents
Range("H2").Select
Sheets("Dashboard").Select
Range("D1").Select
Worksheets("Dashboard").Range("A26") = 0
Application.ScreenUpdating = True
End Sub

Sub TIME_CHECK()
If Worksheets("Dashboard").Range("A26") >= Worksheets("Dashboard").Range("L19") Then Call Reset_Bet
If Worksheets("Dashboard").Range("A27") >= Worksheets("Dashboard").Range("L20") Then Range("A27") = 0
End Sub

Sub TIMEODD()
Worksheets("Dashboard").Range("a25") = 1
**Worksheets("Dashboard").Range("A26") = Range("A26") + 1**
Worksheets("Dashboard").Range("A27") = Range("A27") + 1
Call TIME_CHECK
End Sub

Sub TIMEEVEN()
Worksheets("Dashboard").Range("a25") = 0
Worksheets("Dashboard").Range("A26") = Range("A26") + 1
Worksheets("Dashboard").Range("A27") = Range("A27") + 1
Call TIME_CHECK
End Sub

Public Sub arrRecorder()

Dim ws As Worksheet
Set ws = Worksheets("Recorder")
' Excel 2003 only has 65536 rows
Dim maxRows As Long
maxRows = 65536 ' This value must not be more than the number of rows allowed in Excel

' Clear data after selecting a new market, if that option is ticked
If (ws.Range("A4").Value <> ws.Range("A7").Value) And ws.Range("A7").Value <> "" And ws.Range("D1").Value = True Then
Module1.Clear_Data
End If

' Check whether logging is enabled
If (ws.Range("D2") = True) Then

Application.ScreenUpdating = False

' Find the last used row
Dim lastRow As Long
lastUsedRow = ws.Cells.SpecialCells(xlCellTypeLastCell).Row

'Find the last column
Dim lastUsedColumn As Long
lastUsedColumn = ws.Cells.SpecialCells(xlCellTypeLastCell).Column

' Clear the last used row, so that there is not an error if we try to move data down beyond the last row
' Deleting a row is not super fast, so we only do it if necessary.
' So we do not bother to delete the last used row unless it is near the end of the spreadsheet
' This also ensures that we never accidentally delete our top row containing formulae.
If lastUsedRow >= maxRows Then
' Now delete cells in the last used row (across as far as the lastUsedColumn)
ws.Range(ws.Cells(lastUsedRow, 1), ws.Cells(lastUsedRow, lastUsedColumn)).Delete
End If

' Now move all the data down by one row, by inserting a row
ws.Range(ws.Cells(5, 1), ws.Cells(5, lastUsedColumn)).Insert shift:=xlDown

Dim arr As Variant
'arr = ws.Range("A3:AF3")
arr = ws.Range(ws.Cells(4, 1), ws.Cells(4, lastUsedColumn))

Dim destination As Range
Set destination = ws.Range("A7")
destination.Resize(UBound(arr, 1), UBound(arr, 2)).Value = arr
' Other ways to copy the data:
'ws.Range("A7:AF5").Value = arr
'ws.Range("A7:AF5").Value = ws.Range("A4:AF3").Value
'ws.Range("A7:AF5").Copy destination: ws.Range ("A4:AF3")

Application.ScreenUpdating = True
End If


End Sub

Sub Clear_Data()
Dim ws As Worksheet
Set ws = Worksheets("Recorder")
'ws.Range("A5:AF65536").delete shift:=xlUp
Dim lastDataColumn As Long
lastDataColumn = ws.Cells.SpecialCells(xlCellTypeLastCell).Column
ws.Range(ws.Cells(7, 1), ws.Cells(65536, lastDataColumn)).Clear
End Sub
Sub NotActive()
Dim ws As Worksheet
Set ws = Worksheets("Recorder")
' Just log it once that the market is not active (i.e. Suspended or Closed)
' There is no need to log it more than once, because prices don't change when the market is not active
If ws.Range("D4") <> ws.Range("D7") Then
Call arrRecorder
End If
End Sub

我正在尝试在记录表中记录投注赔率,并尝试在仪表板表中自动下注。记录器工作正常,但无论我链接到其他工作表,它都不会在其他工作表上显示赔率。其次,当我启动工作表时,它给我一个运行时错误“13”的错误:类型不匹配。当我点击调试时,它会将我带到这一行“Worksheets("Dashboard").Range("A26") = Range("A26") + 1"

请帮助我。

最佳答案

像这样:

Sub TIMEODD()
With Worksheets("Dashboard")
.Range("a25") = 1
.Range("A26") = .Range("A26") + 1
.Range("A27") = .Range("A27") + 1
End With
Call TIME_CHECK
End Sub

关于vba - Excel工作表运行时错误13 : Type mismatch.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43037787/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com