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

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -