snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub FindCell2()
Dim FindString As Date
Dim Rng As Range
FindString = Sheets("copy").Range("C4").Value
FindString = DateSerial(Year(FindString) - 543, Month(FindString), Day(FindString))
'FindString = CStr(FindString)
If Trim(FindString) <> "" Then
MsgBox FindString
With Sheets("Plan").Range("A1:AF8")
Set Rng = .Find(What:=Format(FindString, "d/m/yyyy"), _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
Else
MsgBox ("No Data!!!")
End If
End Sub
Sub FindCell2()
Dim FindString As Date
Dim Rng As Range
FindString = Sheets("copy").Range("C4").Value
If Trim(FindString) <> "" Then
With Sheets("Plan").Range("A1:AF8")
Set Rng = .Find(What:=DateValue(FindString), _
LookIn:=xlFormulas)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
Else
MsgBox ("No Data!!!")
End If
End Sub
Sub FindCell2()
Dim FindString As Date
Dim Rng As Range
FindString = Sheets("copy").Range("C4").Value
If Trim(FindString) <> "" Then
With Sheets("Plan").Range("A1:AF8")
Set Rng = .Find(What:=DateValue(FindString), _
LookIn:=xlFormulas)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
Else
MsgBox ("No Data!!!")
End If
End Sub