» Search and copy date values using VBA
CATEGORY - Date & Time in VBA
VERSION - All Microsoft Excel Versions
Answer: Insert the following code in the appropriate modules.
Place the code below into the standard module
Sub Marking()
Dim aCell As Range, bCell As Range
Dim Start
Dim Off
On Error GoTo ErrorHandler
Start = CDate(InputBox("Start:"))
Set aCell = Columns(1).Find(DateValue(Start), LookIn:=xlFormulas)
If aCell Is Nothing Then GoTo ErrorHandler
Off = CDate(InputBox("End:"))
Set bCell = Columns(1).Find(DateValue(Off), LookIn:=xlFormulas)
If bCell Is Nothing Then GoTo ErrorHandler
Worksheets("Sheet2").Cells.ClearContents
Rows(aCell.Row & ":" & bCell.Row).Copy Worksheets("Sheet2").Range("A1")
End
ErrorHandler:
Beep
MsgBox "Not valid Date!"
End Sub
Book Store:
Recommended Books:
- AWAKEN THE GIANT WITHIN : HOW TO TAKE IMMEDIATE CONTROL OF YOUR MENTAL, EMOTIONAL, PHYSICAL AND FINANCIAL
- Financial Statement Analysis with S&P insert card
- Analyzing Markets, Products, and Marketing Plans
- Real Estate Finance and Investments (Real Estate Finance and Investments, 11th Ed)
- MP Managerial Accounting w/ Topic Tackler, Net Tutor, & PowerWeb
- PowerPoint® 2002 For Dummies®
No comments have been submitted.

