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

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
810
Office Version
  1. 365
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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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!
 
Upvote 0
You could just use the builtin excel function for that:

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

Forum statistics

Threads
1,224,919
Messages
6,181,755
Members
453,064
Latest member
robatthe2A

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