Trouble selecting values to feed into custom formula

Solution 1:

You have invalid range references. If the column letter is for example R:

  • Col_Letter(StrtCol + CntH) & "89:92": evaluates to R89:92, but should be R89:R92.
  • Col_Letter(StrtCol + CntH) & "93:93"): evaluates to R93:93, but should be R93.

This is easier to debug using some Range variables:

Dim arg1 As Range
Set arg1 = Wsh.Range(Col_Letter(StrtCol + CntH) & "87") ' fine

Dim arg3 As Range
Set arg3 = Wsh.Range(Col_Letter(StrtCol + CntH) & "89:92") ' blows up

Also note that using the column letter is a bit clunky. Generally prefer Cells over Range if you're working with the column index.

Wsh.Cells(87, StrtCol + CntH)
...
Wsh.Cells(89, StrtCol + CntH).Resize(4) ' rows 89:92
...
Wsh.Cells(93, StrtCol + CntH)