ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Table (https://www.excelbanter.com/excel-programming/318448-simple-table.html)

Dominique Feteau[_2_]

Simple Table
 
I need help creating a small macro. When activated, I want an input box to
come up asking "Week Beginning" & "Week Ending" and fill those dates into
a2:a26 (essentially 5 times) ie:

1/1/2005
1/1/2005
---
---
1/5/2005
1/5.2005

Can someone help me out?

Thanks



Dominique Feteau[_2_]

Simple Table
 
Sorry. I was looking at this all wrong. What I need instead is a way to
just add 7 days to a date thats already in the cell. How do i do that?

"Dominique Feteau" wrote in message
...
I need help creating a small macro. When activated, I want an input box to
come up asking "Week Beginning" & "Week Ending" and fill those dates into
a2:a26 (essentially 5 times) ie:

1/1/2005
1/1/2005
---
---
1/5/2005
1/5.2005

Can someone help me out?

Thanks




Sharad Naik[_2_]

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!


All times are GMT +1. The time now is 01:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com