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: 14
Default Using Date in InputBox for criteria in code

I have the following code:

Sub ShadeCells()

Dim dblSum As Double
Dim cell As Range
On Error GoTo Errhandler:
dblSum = 0
With ActiveSheet.Range("A:A")
For Each cell In .Range("D:D")
If cell.Text < "" Then
If cell.Value <= DateValue("2/08/2005") Then
cell.Offset(0, 1).Interior.ColorIndex = 16
If IsNumeric(cell.Offset(0, 1)) Then
dblSum = dblSum + cell.Offset(0, 1).Value
End If
Else
cell.Offset(0, 1).Interior.ColorIndex = xlNone
End If
Else
cell.Offset(0, 1).Interior.ColorIndex = xlNone
End If
Next
Application.EnableEvents = False

.Range("G1").Value = dblSum
.Font.Bold = True
.NumberFormat = "$#,##0.00"

Application.EnableEvents = True
End With
Errhandler:
Application.EnableEvents = True
End Sub

Works great, now instead of going in and changing the date every 2 weeks
(this is how often I use this code) I would like an InputBox come up and ask
for the date to use and then use that entry in the criteria section:

If cell.Value <= DateValue("2/08/2005") Then

Any suggestions would be great, Thanks!
 
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
InputBox code baehrjf Excel Programming 0 August 12th 04 11:47 PM
InputBox code baehrjf Excel Programming 0 August 12th 04 07:13 PM
InputBox code Mark Excel Programming 0 August 12th 04 08:25 AM
Using InputBox to change query criteria in Access JohnBoy Excel Programming 2 September 16th 03 02:08 PM
Excel Macro Code invoking InputBox. Andrew Thorne Excel Programming 0 July 30th 03 10:23 PM


All times are GMT +1. The time now is 06:40 PM.

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

About Us

"It's about Microsoft Excel"