bobkap
Active Member
- Joined
- Nov 22, 2009
- Messages
- 323
- Office Version
- 365
- Platform
- Windows
- Mobile
- Web
I have thousands of rows of data. In one column there's a string of both text and numbers. Some of the numbers are dates. The dates represent many different years, but I only want the dates for 2016 and 2017. I've tried using the IsStr function but I just could not get it to work.
Here my code lines for this:
banana = InStr((Cells(mirow, micol)), "2016" Or "2017")
If banana = 0 Then
I thought that if 2016 or 2017 was in the string that the result would be zero and in those cases I would do what I need to do with the cells that do and do not have 2016 or 2017 in them. BUT, I get not only zeros for my variable (banana) but weird numbers like 44 and 62 and I have no idea where they come from. Worse, I get hits on all my data, not just the ones that have 2016 or 2017 in the string. Here's an example of what one of my strings looks like:
PC Class 8:00AM-2:00 PM Jan 15th, 2016 (135 Elm St, Anycity, Anystate 34562
[TABLE="width: 445"]
<tbody>[TR]
[TD="width: 445"]
What would be a way to do this correctly please?[/TD]
[/TR]
</tbody>[/TABLE]
Here my code lines for this:
banana = InStr((Cells(mirow, micol)), "2016" Or "2017")
If banana = 0 Then
I thought that if 2016 or 2017 was in the string that the result would be zero and in those cases I would do what I need to do with the cells that do and do not have 2016 or 2017 in them. BUT, I get not only zeros for my variable (banana) but weird numbers like 44 and 62 and I have no idea where they come from. Worse, I get hits on all my data, not just the ones that have 2016 or 2017 in the string. Here's an example of what one of my strings looks like:
PC Class 8:00AM-2:00 PM Jan 15th, 2016 (135 Elm St, Anycity, Anystate 34562
[TABLE="width: 445"]
<tbody>[TR]
[TD="width: 445"]
What would be a way to do this correctly please?[/TD]
[/TR]
</tbody>[/TABLE]