Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Increasing the date with a Macro

In Cell *A1* i have a date. Cell B1 says "=A1"

I run a macro and added +7 to make cell B1 read "=A1+7".

When I run the macro again nothing happens.

I need to be able to run a simple macro and be able to increase th
date by 1 week each time the macro is run.

Can anyone help?

Thanks

Mat

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Increasing the date with a Macro

Matt

correct me if I'm wrong but A1 hasn't changed. So if you keep setting B1 to
read "=A1+7" you're going to keep getting the same answer.

I think you need to change the increment: first time through, add 7; second
time through, add 14; and so on.

Regards

Trevor


"mattwilsonuk " wrote in
message ...
In Cell *A1* i have a date. Cell B1 says "=A1"

I run a macro and added +7 to make cell B1 read "=A1+7".

When I run the macro again nothing happens.

I need to be able to run a simple macro and be able to increase the
date by 1 week each time the macro is run.

Can anyone help?

Thanks

Matt


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Increasing the date with a Macro


"mattwilsonuk " ha scritto nel
messaggio ...
In Cell *A1* i have a date. Cell B1 says "=A1"

I run a macro and added +7 to make cell B1 read "=A1+7".

When I run the macro again nothing happens.

I need to be able to run a simple macro and be able to increase the
date by 1 week each time the macro is run.

Can anyone help?



.....
x = 7
Range("B1").FormulaR1C1 = "=RC[-1]+" & x
......



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Increasing the date with a Macro

How can i make the macro run in increments?

Where does that formula x=7 range.... go?

Thx

Mat

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Increasing the date with a Macro


"mattwilsonuk " ha scritto nel
messaggio ...
How can i make the macro run in increments?

Where does that formula x=7 range.... go?


.....
x = Range("B1")
Range("B1").FormulaR1C1 = "=RC[-1]+" & 7
.....




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Increasing the date with a Macro

I really appreciate you helping me out and ive been tinkering with th
formala you gave me - been moving it around.

I dont know what to do with it tho - I put it somewhere when i run th
macro?

Mat

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Increasing the date with a Macro

Isnt that VBA script because ive not really gone that far into excel an
cant say i know a great del about it - my macro is being created when
to to tools - macro - record new macro.

Mat

--
Message posted from http://www.ExcelForum.com

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Increasing the date with a Macro

Go into the VB IDE (Alt-F11)
Insert a new code module (InsertModule)
Add this code

Sub Add7()
If Range("B1").Value = "" Then
Range("B1").VAlue = Range("A1").Value
Else
Range("B1").Value= Range("B1").Value + 7
End If
Range("B1").Numberformat = "dd mmm yyyy"
End Sub

Then every time you want to increase it, run the Sub acelled Add7.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"mattwilsonuk " wrote in
message ...
Isnt that VBA script because ive not really gone that far into excel and
cant say i know a great del about it - my macro is being created when i
to to tools - macro - record new macro.

Matt


---
Message posted from http://www.ExcelForum.com/



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Increasing the date with a Macro

Fantastic

Thank you Bob - Perfect.

Mat

--
Message posted from http://www.ExcelForum.com

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Increasing the date with a Macro

Matt,

Are both A1 and B1 formated for Dates?
If so in cell B1= A1+7 it should increase 1 week. However if the dat
in A1 stays the same then no matter how many time you run your macr
the date will alway be the same.

HTH

Charle

--
Message posted from http://www.ExcelForum.com



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Increasing the date with a Macro

The date in A1 remains the same throughout.

I was hoping the Macro would create something as crude as

=a1+7+7+7+7+7+7+7+7+7+7+7" depending on the number of times I ran th
macro.

Is there another function I can use to acheive the desired result?

Thx for your input

Mat

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Increasing date in link Rhett C[_2_] Excel Worksheet Functions 7 October 31st 08 08:46 PM
Increasing Macro Efficieny Phin Doyle Excel Discussion (Misc queries) 4 January 15th 07 01:42 PM
Increasing the date/time in cells on a worksheet with a button RMF Excel Worksheet Functions 1 March 6th 06 07:45 PM
macro save a workbook whilst increasing file no shrek Excel Worksheet Functions 0 November 10th 05 02:40 PM
Increasing M in M/D/Y Bill45 Excel Discussion (Misc queries) 2 May 19th 05 06:32 PM


All times are GMT +1. The time now is 10:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"