2017-03-27 14 views
2
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'のエラーを与える:TypeMismatch。 ( "A26")=範囲( "A26")+ 1 "Excelシートランタイムエラー13:タイプの不一致。

私を助けてください、そして、私はデバッグをクリックすると、私はこのライン"ワークシート(ダッシュボード "このよう

+0

は、シート上のセルが '' A26' Dashboards' **が正しい形式で 'number'を持っていることを確認してください**。数字の代わりに文字列や文字列がある場合があります。その場合、不一致がトリガーされます – 3vts

+0

Range()のすべての呼び出しをワークシートオブジェクトで修飾する必要があります。そうでない場合は、アクティブシートがデフォルトになります。 –

+0

そのセルには番号があります。 – YaZ

答えて

2

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 
+0

ありがとうございます。これはmistypeのエラーを修正しましたが、私の最初の問題はまだあります。レコーダーは正常に動作しますが、リンクされている場所では、他のシートにオッズを表示しません。すべてのオッズを記録するが、他のシートには表示しない。 – YaZ

関連する問題