Macro for automatization filtering dates

CnstMot

New Member
Joined
Dec 11, 2019
Messages
1
Office Version
  1. 2013
Platform
  1. Windows
Hi everyone. I have a large database (pic adjointed) and I want to do a macro in which if I put a date it returns me the TIR, Duración and Nominal Outstanding of that date (dates goes from 2019 until 2015).

Best,
 

Attachments

  • Sin título.jpg
    Sin título.jpg
    49.2 KB · Views: 6

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I couldn't see the detail of your worksheet because the picture was a bit blurred on my Pc, however this code assume the dates are in column B and it returns columns C ,D and E,
If these are not the correct columns just change the index values in the txt= line. Inarr(i,3) is the third column (C) inarr(4,) is D ,etc etc
VBA Code:
Sub test2()

myinp = (Application.InputBox("Enter a date"))
If IsDate(myinp) Then

lastrow = Cells(Rows.Count, "A").End(xlUp).Row
inarr = Range(Cells(1, 1), Cells(lastrow, 13))
  For i = 1 To lastrow
   If myinp = CDate(inarr(i, 2)) Then
    txt = inarr(i, 3) & " / " & inarr(i, 4) & " / " & inarr(i, 5)
    MsgBox (txt)
    Exit For
   End If
  Next i
 End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,543
Members
449,089
Latest member
davidcom

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