av8tordude
10-07-2011, 05:46 PM
Can someone assist with a code that will look in column B (Range B11:B250) and determine if a date exist. If so, go to that cell with requested date. If not, then exit sub.
Thank you for your assistance.
Maybe:
Option Explicit
Sub exa()
Dim ret As String
Dim arySplit() As String
Dim rng As Range
Dim dtmLookFor As Date
ret = Application.InputBox( _
"Enter the date in the following format: m,d,yyyy" & vbCrLf & _
"That is, a one or two digit number for the month, followed by a comma," & _
" followed by a one or two digit number for the day, followed by a comma," & _
" followed by a four digit number for the year.", "Enter Date", , , , , , 2)
If InStr(1, ret, ",") Then
arySplit = Split(ret, ",")
If UBound(arySplit) = 2 Then
dtmLookFor = DateSerial(Trim(arySplit(2)), _
Trim(arySplit(0)), _
Trim(arySplit(1)))
Set rng = Range("B11:B250").Find(dtmLookFor, Range("B250"), xlFormulas, xlWhole)
If Not rng Is Nothing Then
Application.Goto rng, True
End If
End If
End If
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.