Private Sub CommandButton3_Click() Dim wsLog As Worksheet, wsData As Worksheet Dim…
- User
Private Sub CommandButton3_Click()
Dim wsLog As Worksheet, wsData As Worksheet Dim lastRowLog As Long, lastRowData As Long, r As Long, i As Long Dim folderPath As String, txtFileName As String, xlsxFileName As String Dim fileContent As String Dim startNum As Integer, placedValue As String ' Set?m sheet-urile Set wsLog = ThisWorkbook.Sheets("Sheet2") Set wsData = ThisWorkbook.Sheets("Sheet1") ' Determin?m ultimul rând folosit pe fiecare sheet lastRowLog = wsLog.Cells(wsLog.Rows.Count, 2).End(xlUp).Row lastRowData = wsData.Cells(wsData.Rows.Count, 2).End(xlUp).Row For r = 1 To lastRowLog folderPath = wsLog.Cells(r, 2).Value If Right(folderPath, 1) <> "" Then folderPath = folderPath & "" For i = 1 To lastRowData xlsxFileName = wsData.Cells(i, 2).Value If Len(xlsxFileName) > 0 Then txtFileName = folderPath & Left(xlsxFileName, Len(xlsxFileName) - 4) & ".txt" If Dir(txtFileName) <> "" Then ' Deschide ?i cite?te con?inutul fi?ierului .txt Open txtFileName For Input As #1 fileContent = Input(LOF(1), #1) Close #1 ' Extrage valoarea numeric? dup? "Placed:" startNum = InStr(fileContent, "Placed:") + Len("Placed:") placedValue = Mid(fileContent, startNum) placedValue = Trim(Val(placedValue)) ' Extrage ?i converte?te la num?r ' Scrie valoarea numeric? în coloana G wsData.Cells(i, 7).Value = placedValue End If End If Next i Next r MsgBox "Actualizare complet?."End Sub ACTUALIZEAZA ACEST COD SA FOLOSESSCA SI "TAIERI" IN Extrage valoarea numerica dupa "Placed:"
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.