If Date add 5 days

seacrest

Active Member
Joined
Aug 15, 2002
Messages
301
I need a macro that will run down column B and add 5 days to an existing date
If empty do nothing
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Try...

Code:
Sub AddtoDate()
    Dim LR As Long
    Dim i As Long
    LR = Range("B" & Rows.Count).End(xlUp).Row
    For i = 1 To LR
        If Range("B" & i) <> "" Then
            Range("B" & i).Value = Range("B" & i) + 5
        End If
    Next i
End Sub
 
Upvote 0
This foolow code should make the changes requested to worksheets(1)

Code:
Sub add5days()
    Dim RowNo As Long
    For RowNo = 2 To ThisWorkbook.Worksheets(1).UsedRange.Rows.Count
        If IsEmpty(Cells(RowNo, 2)) Then
            'do nothing
        Else
            Cells(RowNo, 2) = Cells(RowNo, 2) + 5
        End If
    Next RowNo
End Sub
 
Upvote 0
I think Jeffery is offline ATM
Is the add offset, instead of the code Jeffrey has given you, or an extra to the code ?
Code:
 If Range("B" & i) <> "" AND range("B" & i).Offset(,1) ="Overdue" Then
or
Code:
 If Range("B" & i) .offset(,1) = "Overdue" Then
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,025
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top