Solved

Vba and formula to change date

Posted on 2016-10-18
4
40 Views
Last Modified: 2016-10-18
Can an expert help me out with this,

Looking for code that will find the first date in column N and change it from whatever date is there to that date plus 1

Many thanks
0
Comment
Question by:Jagwarman
  • 2
  • 2
4 Comments
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 41848231
HI,

pls try
Sub Macro()
For Each c In Range(Range("N1"), Range("N" & Rows.Count).End(xlUp))
    If IsDate(c) Then
        c.Value = c.Value + 1
        Exit For
    End If
Next
End Sub

Open in new window

Regards
0
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41848236
If you have to add one day to the formula then try
Sub Macro1()
For Each c In Range(Range("N1"), Range("N" & Rows.Count).End(xlUp))
    If IsDate(c) Then
        c.Formula = c.Formula & "+ 1"
        Exit For
    End If
Next
End Sub

Open in new window

0
 

Author Comment

by:Jagwarman
ID: 41848258
brilliant many thanks
0
 

Author Closing Comment

by:Jagwarman
ID: 41848262
Rgonzo you are really one of the best.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question