LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Macro VBA help needed

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
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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
MACRO NEEDED AshMorK Excel Discussion (Misc queries) 7 November 27th 06 05:47 PM
Macro Needed - Please Help! SmokingMirror[_2_] Excel Programming 2 October 8th 05 03:35 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 12:31 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"