find last occurence of x

jarhead58

Active Member
Joined
Sep 21, 2017
Messages
367
Office Version
  1. 2021
Platform
  1. Windows
Hello everyone!

I'm looking for the easiest way to find the last time "X" occured in a column via a module I'm calling test for now. Specifically, find the last time "X" occurs in col g on sheet2 lets say, if true, offset(7, 0) and then put "X" in that cell from the offset. TIA
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Try this in your macro...

Sheets("Sheet2").Columns("G").Find("X", , , xlWhole, , xlPrevious, False, , False).Offset(7) = "X"
 
Last edited:
Upvote 0
Try this in your macro...

Sheets("Sheet2").Columns("G").Find("X", , , xlWhole, , xlPrevious, False, , False).Offset(7) = "X"

Thank you so much for that! I tried doing something with a For Next but it kept erroring.

Now also have dates in column a starting at row 2 on the same page. Would I use something like, If sheets("sheet2").range("G2:G26").value <> "X" AND
sheets("sheet2").range("A2:A26") = TODAY() Then, not sure how to format this, make this cell value "X". Would that work
 
Upvote 0
Sorry about that! The intersecting cell of Today() in col A and col G, eg, A6 and G6
 
Upvote 0
Sorry about that! The intersecting cell of Today() in col A and col G, eg, A6 and G6

Will a cell equal to TODAY() appear only once in Column A or could today's date appear more than once in Column A?

If more than once, are we supposed to put the "X" in Column G for only the last today date for do it for all the today dates?
 
Upvote 0
Will a cell equal to TODAY() appear only once in Column A or could today's date appear more than once in Column A?

If more than once, are we supposed to put the "X" in Column G for only the last today date for do it for all the today dates?

Just once and thank you for the reply and time sir!
 
Upvote 0
Mr. Rothstein

Were you able to come up with anything that would help with the above?
 
Upvote 0

Forum statistics

Threads
1,224,743
Messages
6,180,692
Members
452,994
Latest member
Janick

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