VBA Find Function

smartpat19

Board Regular
Joined
Sep 3, 2014
Messages
114
HI All,

Working on my first find function. I am trying to return the range. The formatting is dates and I am trying the find what cell the date is in row 7. Right now I am returning nothing.


VBA Code:
Sub Retainage_Macro()

Dim proforma As Workbook
Set proforma = ActiveWorkbook
Dim master As Workbook

Dim Current_Month As Range

Set Sht = Sheets("Project Summary")
Set cfs = Sheets("Cash Flow Template")

Start = cfs.Range("E1").Value

Set Current_Month = cfs.Range("7:7").Find(What:=Start, Lookat:=xlWhole, MatchCase:=False)

MsgBox (Current_Month)

Thank you
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You could change Rows(7) to Columns(1) and reverse things in Cells.

So something like this perhaps.
VBA Code:
Res = Application.Match(CDbl(Start), cfs.Columns(1), 0)

If Not IsError(Res) Then
        Set Current_Month = cfs.Cells(Res, 1)
        MsgBox Current_Month.Value
    Else
        MsgBox "Start not found!"   
End If
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,877
Members
449,056
Latest member
ruhulaminappu

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