VBA Help

Jav_uk8

New Member
Joined
Jan 12, 2017
Messages
22
Hi All,

I need help on the following VBA code.

I need to amend the formula below into a VBA code. I need to amend the 'O2:O662' section to show O2:O" & lastrow (used in previous VBA) or something that will work.

=CONCATENATE("Number of Cases"," ",COUNTIF(O2:O662,">=£0.01")," ","out of"," ",COUNTA(O2:O662))

Hope this makes sense?

Cheers :)
 
Last edited:

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Say you want to place this formula in cell A1. Then assuming you have already calculated lastrow, you would just use:
Code:
Range("A1").Formula = "=CONCATENATE(""Number of Cases"","" "",COUNTIF(O2:O" & lastrow & ","">=£0.01""),"" "",""out of"","" "",COUNTA(O2:O" & lastrow & "))"
If you have not already calculated lastrow, you would do so like this:
Code:
Dim lastrow as Long
lastrow = Cells(Rows.Count,"O").End(xlUp).Row
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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