Solved

Vba and formula to change date

Posted on 2016-10-18
4
46 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 52

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 52

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
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…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

624 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