max - VBA code to find out maximum value in a range and add 1 to the value in the other cell -


you may find question little strange need calculation worksheet.

firstly, post requirement based on request share vba code. however, built poorly.

i need vba code find maximum value in range (i11 i21) , taking value, have add 1 (+1) in other cell "g2".

please me code this. appreciated.

here go simple 1 line solution:

public sub testme()     range("g2") =  worksheetfunction.max(range("i11:i21")) + 1 end sub 

or

public sub testme()     range("g2") = range("g2") +  worksheetfunction.max(range("i11:i21")) + 1 end sub 

depending on want do.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

android - IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling -