find last occurence of x

jarhead58

Active Member
Joined
Sep 21, 2017
Messages
348
Office Version
  1. 2016
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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,213,530
Messages
6,114,163
Members
448,554
Latest member
Gleisner2

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