# Revision history [back]

### Incrementing within strings for user defined function

I have a user defined function called

countExcusedFields("B4:U4")


It is used to count all field with a certain background color.

Function countExcusedFields(oSheetName, oRange)
Dim oCellRange As Variant
Dim oSheet As Variant
oSheet = ThisComponent.getCurrentController().getActiveSheet()
oCellRange = oSheet.getCellRangeByName(oRange)


It work's pretty well, but as I give a string as argument value i have to problem that is wont auto increment B5:U5, B6U6 and so on. Is there any way to get LO to autoincrement a value within this string so I don't need to edit 300 rows by hand ?