Macro or Formula to GO TO a particular Month

SelinaR

Board Regular
Joined
Feb 2, 2012
Messages
65
Office Version
  1. 2021
Platform
  1. Windows
  2. Mobile
  3. Web
Hiya

I have a current Macro that finds a date....
Sub searchdate()
Dim i, lr As Integer
lr = ActiveSheet.Range("A65536").End(xlUp).Row

For i = 3 To lr
If Cells(i, 1) = Date Then
Cells(i, 1).Select
Exit For
End If
Next i

End Sub

However I have a spreadsheet that I need to only find the current month that I am in - Column B is the column that hold each month heading from 2010.
EG: Jan-2010

Is there a "Go to" function, a formula or a Macro possible to do this - as I've attempted to manipulate the above Macro and it's not working :( :mad:

THANKS
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Column B is the column that hold each month heading from 2010.
EG: Jan-2010

Hi - is this the text "Jan-2010" or a date serial formatted to display mmm-yyyy? If it's a date serial is it the 1st of the month?
 
Upvote 0
Hi - is this the text "Jan-2010" or a date serial formatted to display mmm-yyyy? If it's a date serial is it the 1st of the month?

It is actually a date formula mmm-yyy - is there a way to jump to a month :)
 
Upvote 0
Give this a try:

Code:
Sub SearchDate()
Dim r As Range
   Set r = Columns("B").Find(What:=Format(Date, "mmm-yyyy"), LookIn:=xlValues, LookAt:=xlWhole)
   If Not r Is Nothing Then r.Select
End Sub
 
Upvote 0
Give this a try:

Code:
Sub SearchDate()
Dim r As Range
   Set r = Columns("B").Find(What:=Format(Date, "mmm-yyyy"), LookIn:=xlValues, LookAt:=xlWhole)
   If Not r Is Nothing Then r.Select
End Sub


*** YOU ARE A TRUE GENUIS!!!

Thanks a million - you've saved at least 35 minutes of every working day of my life from having to scroll!

BRILLIANT!!! :p:p:LOL:
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top