GO TO THE LAST DATA BASED ON 2 CELL DATA

wndncg

Board Regular
Joined
Mar 24, 2017
Messages
84
Office Version
  1. 2019
  2. 2016
  3. 2013
I have a working code just for 1 data but i need based on 2 data. ty mrexcel.

Dim Rng As Range
Set Rng = Range("A" & Rows.Count).End(xlUp).Offset(1)
Set wsCellVal = Sheets("TEMPLATE")
Set wsFIN = Sheets("FIN")
cv = wsCellVal.Range("E1")
Columns("A").Find(cv, After:=Rng, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False, _
SearchFormat:=False).Select
Application.Wait (Now + TimeValue("00:00:01"))
'wsFIN.Activate
'Call INSERT_ROW_SPECIFIC
'ActiveCell.EntireRow.Insert
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
This is a wild guess. Is this what you want to do?
VBA Code:
Sub Find_Cell_In_Column_A_Of_Active_Sheet_That_Matches_Value_E1_Of_Sheet_TEMPLATE()

Dim rng As Range
Set rng = Cells(Rows.Count, "A").End(xlUp)

Range("A:A").Find( _
    Sheets("TEMPLATE").Range("E1").Value, After:=rng, _
    SearchOrder:=xlByRows, SearchDirection:=xlPrevious, _
    MatchCase:=False, SearchFormat:=False).Select

End Sub
 
Upvote 0
This is a wild guess. Is this what you want to do?
VBA Code:
Sub Find_Cell_In_Column_A_Of_Active_Sheet_That_Matches_Value_E1_Of_Sheet_TEMPLATE()

Dim rng As Range
Set rng = Cells(Rows.Count, "A").End(xlUp)

Range("A:A").Find( _
    Sheets("TEMPLATE").Range("E1").Value, After:=rng, _
    SearchOrder:=xlByRows, SearchDirection:=xlPrevious, _
    MatchCase:=False, SearchFormat:=False).Select

End Sub

yes but based on a value on A1 and E1
 
Upvote 0
yes but based on a value on A1 and E1
I would assume that A1 and E1 are both from Sheet TEMPLATE, correct? And if so, it is to search for both the value of A1 and E1 (from Sheet TEMPLATE) such that, if when it searches for, say, A1's value but doesn't find it in Column A of the active sheet . . . that it will then repeat the process but search instead for E1's value (from Sheet TEMPLATE)?
 
Upvote 0
I would assume that A1 and E1 are both from Sheet TEMPLATE, correct? And if so, it is to search for both the value of A1 and E1 (from Sheet TEMPLATE) such that, if when it searches for, say, A1's value but doesn't find it in Column A of the active sheet . . . that it will then repeat the process but search instead for E1's value (from Sheet TEMPLATE)?
Here's an image:

I need a macro that:
It will go the last data (date on column A) on conditions (if data on A1 matches on date in E1)
-example if in E1 is 02/01/2022 it will go to the row 13 because it is the last data.
1663557987329.png
 
Upvote 0
Here's an image:

I need a macro that:
It will go the last data (date on column A) on conditions (if data on A1 matches on date in E1)
-example if in E1 is 02/01/2022 it will go to the row 13 because it is the last data.
So all of this is in the same sheet then. (The sheet you are looking at is Sheet TEMPLATE.) Okay, what happens if the dates in A1 and E1 don't match? What should it do? Nothing?
 
Upvote 0
So all of this is in the same sheet then. (The sheet you are looking at is Sheet TEMPLATE.) Okay, what happens if the dates in A1 and E1 don't match? What should it do? Nothing?
yes nothing sir.
yes sheet TEMPLATE
 
Upvote 0
Okay, just one more thing before I continue attempting coding. It appears that the number formatting of A1 is not set to date like the others. I just wanted to let you know that. That will pose a problem with this comparison! (Please fix that.)
 
Upvote 0
Wait, you want to have the last date possible in column A that matches E1 whose value in the same row in Column B matches the value in A1?
 
Upvote 0
Okay, just one more thing before I continue attempting coding. It appears that the number formatting of A1 is not set to date like the others. I just wanted to let you know that. That will pose a problem with this comparison! (Please fix that.)
what format should i use sir? its currently mm/dd/yyyy
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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