У меня проблема с вставкой данных на разные листы. Выполняемая мной программа продолжает сохранять данные в том же листе, хотя я установил его Sheets1/Sheets2. Пожалуйста, помогите, спасибо.Вставить данные в разные листы excel vba
Первая кнопка:
NextRow = ThisWorkbook.Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row + 1
'Loop through each file in the folder
For Each objFile In objFolder.files
'List the name, size, and date/time of the current file
Cells(NextRow, 1).Value = objFile.Name
Cells(NextRow, 2).Value = objFile.Path
Cells(NextRow, 3).Value = Format(objFile.DateLastModified, "dd/mm/yyyy hh:mm:ss")
'Find the next row
NextRow = NextRow + 1
Next objFile
Вторая кнопка:
NextRow = ThisWorkbook.Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row + 1
'Loop through each file in the folder
For Each objFile In objFolder.files
'List the name, size, and date/time of the current file
Cells(NextRow, 1).Value = objFile.Name
Cells(NextRow, 2).Value = objFile.Path
Cells(NextRow, 3).Value = Format(objFile.DateLastModified, "dd/mm/yyyy hh:mm:ss")
'Find the next row
NextRow = NextRow + 1
Next objFile
С уважением, YY
Сделал это, спасибо! – whywhy