我有一列有日期示例2016-10-05和2列我有天数(天数总是不同,如14,16,18)。在我的专栏3中,我希望得到结果。日期+天数。 我试过了
Public Sub Insert_Columns()
Dim wks As Worksheet
Dim iCol As Long
For Each wks In ActiveWindow.SelectedSheets
With wks
For iCol = .Cells(1, Columns.Count).End(xlToLeft).Column To 1 Step -1
'Add a column to the right of each column.
.Cells(1, iCol + 1).EntireColumn.Insert
'Fill the new column with the value from the first row of the column to its left.
Range(.Cells(2, iCol + 1), .Cells(.Cells(1, iCol).End(xlDown).Row, iCol + 1)) = .Cells(1, iCol)
Next iCol
'Delete the first row.
.Cells(1, 1).EntireRow.Delete
End With
Next wks
End Sub
但我总是有不同的数字而不是像例子一样。
感谢您的帮助。
答案 0 :(得分:1)
只需将列名插入ADD_DAYS函数即可。
SELECT ADD_DAYS (TO_DATE ("COL_1", 'YYYY-MM-DD'), "COL_2") "add days" FROM table;