Solved

Vba and formula to change date

Posted on 2016-10-18
4
38 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 49

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 49

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

831 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