Thread: Simple Table
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sharad Naik[_2_] Sharad Naik[_2_] is offline
external usenet poster
 
Posts: 2
Default Simple Table

Define a variable as date and you can simply do addition substraction
like normal maths.

E.g.
1. Below code will display 7 days after current date
MsgBox Date + 7

2. Below code assumes that a valid date is already in Cell A2, and puts
a date of 7 days later in to cell A3. It shows how to assign the dates
to date variables.

Dim myDate As Date, myNewDate As Date

myDate = Worksheets("Sheet1").Range("A2")
myNewDate = myDate + 7
Worksheets("Sheet1").Range("A3") = myNewDate

3. Same as above but without using any variable
Worksheets("Sheet1").Range("A3") = Worksheets("Sheet1").Range("A2") + 7

Sharad

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!