我的代码在声明变量时卡在中间 - 我是 VBA 的新手

My Code stuck in mid while variable is declared - I am new to VBA

'my code is to copy data from each sheet in an open workbook and paste in its mastedatasheet.

Sub CallData()
            
        Dim CorpFile As Worksheet, CopyRg As Range, PasteRg As Range
        
        Set CorpFile = Sheets("MasterData")
        Set CopyRg = ActiveSheet.UsedRange
        Set PasteRg = CorpFile.Cells(Rows.Count, 1).End(xlUp).Row + 1 'it is stuck here
        
        For Each Sheet In ThisWorkbook
        
        If ActiveSheet.Name <> CorpFile Then
        
        CopyRg.Copy PasteRg
        
        End If
        
        Next Sheet
        
        End Sub
Option Explicit
Sub CallData()

    Dim CorpFile As Worksheet, sheet As Worksheet
    Dim PasteRg As Range
        
    Set CorpFile = ThisWorkbook.Sheets("MasterData")
    
    For Each sheet In ThisWorkbook.Sheets
    
        If sheet.Name <> CorpFile.Name Then

            Set PasteRg = CorpFile.Cells(Rows.Count, 1).End(xlUp).Offset(1)
            sheet.UsedRange.Copy PasteRg
            
        End If
    
    Next sheet
        
End Sub