
Originally Posted by
Paul_Hossler
Not tested, but maybe something like this
Option Explicit
Const addrPrefix As String = "B1"
Const addrDataToSum As String = "G105"
Sub Rollup()
Dim ws As Worksheet
Dim dSum As Double
Dim sPrefix As String
'trim prefix and make UC and add * for the Like
sPrefix = Trim(UCase(Worksheets("Rollup").Range(addrPrefix))) & "*" ' <<<<<< change
For Each ws In ActiveWorkbook.Worksheets
If UCase(ws.Name) Like sPrefix Then
dSum = dSum + ws.Range(addrDataToSum)
End If
Next
Worksheets("Rollup").Range(addrPrefix).Value = dSum
End Sub
Thanks Paul, This worked great.
I made one change to the code (last line) to where the output value was:
Worksheets("Rollup").Range(addrPrefix).Value = dSum
'Changed to
Worksheets("Rollup").Range(addrDataToSum).Value = dSum