The same as Wildcard replacement when using Sumproduct

FuzzyTom

New Member
Joined
May 26, 2011
Messages
24
I found this answer to a query similar to mine, Wildcard replacement when using SUMPRODUCT

I have a little different situation ... namely I am looking to find out how to apply this solution in VBA:

I have a variable ClName which is assigned to the tab name and I would like to check if this tab name, or ClName has an extension "ccs". So I did the following:

If TabName.Formula = Evaluate("=Sumproduct(--(Right(TabName,3 "=" ""ccs"")))") = True Then
NewSheet.Tab.Color = 32
Else
NewSheet.Tab.Color = 128
Endif

I get invalid qualifier ... so I tried the same argument without formula and of course it is just ignored.

Any suggestions ... thanks.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Is something like this what you want?

Code:
Sub test()
Dim clName As String
clName = ActiveSheet.Name
Worksheets.Add
If Right(clName, 3) = "css" Then ActiveSheet.Tab.Color = 32 Else ActiveSheet.Tab.Color = 128
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,772
Messages
6,132,615
Members
449,740
Latest member
tinkdrummer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top