相关疑难解决方法(0)

使用excel中的vba将日期添加到日期

我想通过一个弹出框添加x天数到一个长日期.

Public Function AskForDeadlinePlus4() As String
    Dim strUserResponse As String

    strUserResponse = InputBox("Enter Validuntil Date: Add # of Days To Survey end date")
    strUserResponse = FormatDateTime(strUserResponse + I2, vbLongDate)
    ActiveSheet.Cells(2, 10).Value = strUserResponse 'the 2, 10 is the cell reference for J2 - row 2, column 10.

End Function
Run Code Online (Sandbox Code Playgroud)

调查结束日期在单元格I2中.

当我运行这个我得到(谷歌搜索如何做到这一点,我很累)

4 + I2(何处I2 = Friday, April 05, 2013)>> Wednesday, January 03, 1900

当然我需要 Tuesday, April 09, 2013

谢谢

excel vba date excel-vba

6
推荐指数
1
解决办法
6万
查看次数

标签 统计

date ×1

excel ×1

excel-vba ×1

vba ×1