Get value of next non-blank cell above the activecell.row, "O" cell

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
671
Office Version
  1. 2010
Platform
  1. Windows
Hi all,

Have timestamps in column O that can either be blank or non-blank, I'm looking to find the last time stamp in column O


If I'm on row 44 in column A, and the last timestamp is on row 41 in column O, how do I say to excel:

Code:
LastTime = Cells(ActiveCell.Row, "O").Selection.End(xlUp).Value

The above errors out because, let's face it, it's a mis-mash of incompatible code.

I want to find the result in column O of the last timestamp above the active row.

Thanks!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

trunten

Active Member
Joined
Jul 26, 2011
Messages
479
You are pretty close. Try:
Code:
LastTime = Cells(ActiveCell.Row, "O").End(xlUp).Value
 

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
671
Office Version
  1. 2010
Platform
  1. Windows
You are pretty close. Try:
Code:
LastTime = Cells(ActiveCell.Row, "O").End(xlUp).Value

Wonderful, if but for one word I wouldn't have had to trouble you!

Now my next challenge, for "TotalTime" variable I want to sum column O:


Code:
ProgBox.TotalTime.Caption = ????

Do I use Evaluate for this? Never used it before. Cheers!
 

trunten

Active Member
Joined
Jul 26, 2011
Messages
479
You could just use the builtin excel function for that:

Code:
ProgBox.TotalTime.Caption = Application.Sum(Range("O:O"))
 

Forum statistics

Threads
1,141,309
Messages
5,705,675
Members
421,404
Latest member
Mikecollo

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
Top