Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I recorded these two macros to increment / decrement a date used in a
database query. I assigned them to two buttons that users can use to page through sales activity one day at a time. Now I want to limit the range of dates available. For the NextDate macro, if the resulting date is greater than "today", I want it to revert to "today". For the PrevDate macro, if the resulting date is less than "today -14", it should stay at "today-14". I don't know enough VBA to make it happen (I just use the recorder), but I know there are many here who can do it. Cell B1=1, Cell C1 contains the date being changed. -- Carlos ================================================= Sub NextDate() ' ' NextDate Macro ' Macro recorded 01/12/2006 by Carlos ' ' Range("B1").Select Selection.Copy Range("C1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _ :=False, Transpose:=False End Sub ---------------------------------------------------------------------------- Sub PrevDate() ' ' PrevDate Macro ' Macro recorded 01/12/2006 by Carlos ' ' Range("B1").Select Selection.Copy Range("C1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlSubtract, _ SkipBlanks:=False, Transpose:=False End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
MACRO NEEDED | Excel Discussion (Misc queries) | |||
Macro Needed - Please Help! | Excel Programming | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |