Aqui está o que estou tentando fazer:
Elapsed Days = (the date+time calculated in the column to the left of the cell) − the date+time inputted in Cell B5 of my "Guide" sheet.
Aqui está o meu código até agora:
Sub MudlineData()
sNamer = "Mudline"
Dim dateArr(8) As Double
CreateSheetIf (sNamer)
Sheets(sNamer).Cells.ClearContents
Dim currentSheet As Range
Set currentSheet = Sheets(sNamer).Cells(1, 1) 'Where the current data is going to be pasted
currentSheet.Offset(0, 0) = "Time"
currentSheet.Offset(0, 1) = "Elapsed Days"
currentSheet.Offset(0, 2) = "Mudline(m)"
currentSheet.Offset(0, 3) = "Fluid Level(m)"
Set currentSheet = Sheets("Mudline").Cells(2, 1)
' gets info from Guide sheet
file_dir = Sheets("Guide").Cells(2, 2).Value
filey = Sheets("Guide").Cells(2, 3).Value
fullFile = file_dir & "\" & filey
StartT = Sheets("Guide").Cells(2, 5).Value
Dim wb As Workbook
Application.ScreenUpdating = False
Set wb = Workbooks.Open(fullFile, True, True)
lasty = wb.Worksheets(1).Cells(wb.Worksheets(1).Rows.Count, "A").End(xlUp).Row
With ThisWorkbook.Worksheets(sNamer)
For r = 3 To lasty
'Date and Time
currentSheet.Offset(0, 0) = wb.Worksheets(1).Cells(r, 1) + wb.Worksheets(1).Cells(r, 2)
'Elapsed Days
currentSheet.Offset(0, 1) = currentSheet.Offset(0, 0) - StartT
'Mudline
currentSheet.Offset(0, 2) = wb.Worksheets(1).Cells(r, 3)
'Fluid Level
currentSheet.Offset(0, 3) = wb.Worksheets(1).Cells(r, 4)
Set currentSheet = currentSheet.Offset(1, 0)
Next r
End With
wb.Close False
Set wb = Nothing
Application.ScreenUpdating = True
End Sub