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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,127
Messages
6,129,022
Members
449,481
Latest member
joaotcosta23

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