Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-23-2018, 11:40 AM
charlesdh charlesdh is offline Find Date Month Windows 7 32bit Find Date Month Office 2010 32bit
Expert
Find Date Month
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

As usual I found a solution as to my problem after a request from you. Would still like see what I did wrong with the code that I have in the file.

Charles
Reply With Quote
  #2  
Old 07-23-2018, 04:21 PM
macropod's Avatar
macropod macropod is offline Find Date Month Windows 7 64bit Find Date Month Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by charlesdh View Post
Would still like see what I did wrong with the code that I have in the file
Well, you said you were looking for just the month, but strdate is only ever defined as a date in the format "mmm-yyyy". Naturally, that looks for the month and year, and will only find them if separated by a '-'. Furthermore, your Find expression looks at the formulae, not the displayed strings and requires a whole-of-cell match instead of a partial match. Try using something along the lines of:
Code:
Sub FindDate()
Dim strdate As String, rCell As Range, lReply As Long
strdate = Format(Sheets("Sheet2").Cells(2, 4).Text, "mmm")
Set rCell = Sheets("Sheet1").Cells.Find(What:=strdate, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not rCell Is Nothing Then MsgBox rCell.Address
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
if cell contains date, then month, else blank Merlot Excel 7 03-20-2025 08:16 AM
Find Date Month Auto update excel graph range, ignore data when date reads 00-Month-00 SavGDK Excel 2 06-24-2016 08:05 AM
Excel day date month year Function greginky Excel 1 01-05-2016 02:19 AM
Find Date Month Filter by a Month that falls within a date range MattG1225 Excel 2 12-03-2015 07:44 AM
Formula to subtract one month from due date field in reminder field ghumdinger Outlook 1 10-01-2011 12:09 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft