Q:

Add one day to a date field in all cells in a row - VBA

I have a date (2/1/2018)in D1 cell and now I want to increase date by one in all cells from D2 to AH using VBA
Any suggestion ?
THanks
Sree

A:

Please note that if variable data type is set as Date it will increasing day of date when summing with 1.
VBA:
Sub DateIncreaser

    Dim d as Date
    d = Selection.value 'Assign appropriated value to d variable.
    d = d + 1
    debug.print d 'This optional line shows the result in immediate window.
    Range("D2").Value = d

End Sub

Update1
Sub DateIncreaser()

    Dim d As Date
    Dim i As Integer
    Dim InitialColumnIndex As Integer
    Dim FinalColumnIndex As Integer
    Dim RowsIndex As Long

    InitialColumnIndex = 1
    FinalColumnIndex = 34 'Representative AH Column
    RowsIndex = 2
    d = Selection.Value 'Source date value

    For i = InitialColumnIndex To FinalColumnIndex
        d = d + 1
        Cells(RowsIndex, i).Value = d
    Next i

End Sub

Update2
Sub DateIncreaser()

    Dim d As Date
    Dim i, j As Integer
    Dim InitialColumnIndex As Integer
    Dim FinalColumnIndex As Integer
    Dim RowsIndex As Long

    InitialColumnIndex = 1
    FinalColumnIndex = 34 'Representative AH Column
    RowsIndex = 2

    For j = 1 To Sheets.Count

        d = Range("D1").Value 'Source date value

        For i = InitialColumnIndex To FinalColumnIndex
            d = d + 1
            Worksheets(j).Cells(RowsIndex, i).Value = d
        Next i

    Next j

End Sub

