0
런타임 오류 '1004'(응용 프로그램 정의 또는 개체 정의 오류)가 나타납니다. 두 번째 줄에서 마지막 줄까지 진행됩니다.VBA Excel에서 런타임 오류 '1004'
또한 누구나 동일한 코드 줄에서 얻는 대답을 정의하는 방법을 알고 있습니까?
Private Sub selectTable()
Dim startingRow As Integer
Dim endingRow As Integer
Dim startingColumn As Integer
Dim endingColumn As Integer
Dim selectRow As Integer
Dim selectColumn As Integer
startingRow = 13 'This is the row where the table you are sihing to select starts
startingColumn = 5 'This is the row where the table you are wishing to select starts
endingRow = 0 'Variable to hold count of how many rows of data there are
endingColumn = 0 'Variable to hold count of how many columns of data there are
While Cells(startingRow, startingColumn) <> "" 'Counts number of rows that have data
endingRow = endingRow + 1
startingRow = startingRow + 1
Wend
startingRow = 13 'This is the row where the table you are sihing to select starts
startingColumn = 5 'This is the row where the table you are wishing to select starts
While Cells(startingRow, startingColumn) <> "" 'Counts number of columns that have data
endingColumn = endingColumn + 1
startingColumn = startingColumn + 1
Wend
startingRow = 13 'This is the row where the table you are sihing to select starts
startingColumn = 5 'This is the row where the table you are wishing to select starts
selectRow = startingRow + endingRow - 1
selectColumn = startingColumn + endingColumn - 1
Worksheets("General Information").Range(Cells(Row1, Col1), Cells(Row3, Col3)).Select 'Selects the entire range of the desired table
End Sub
을 정의? 내가 게시 한 코드에는 표시되지 않습니다. – sous2817
저는 바보예요. 모든 변수를 바꿨고, 변수를 업데이트해야한다는 것을 몰랐습니다. 고맙습니다! – Saverio
그런 일에 도움이되는 구글 "VBA Option Explicit". – sous2817