Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Will someone PLEASE tell me how to use wildcards in VBA IF...THEN statements! Here's an example of what I'm trying to accomplish:
If ActiveSheet.Name <> "FORMMANAGER_EXPORT_XLS^*" Then
MsgBox "This sheet cannot be transferred."
End
End IfObviously, this doesn't work, but you can see what I want. The sheet name will always begin with "FORMMANAGER_EXPORT_XLS", but it will have various different characters after that i.e. "FORMMANAGER_EXPORT_XLS1a047"
Thanks for helping an idiot :-)

Well, I don't know Visual Basic, but..
The If Then Else means..
If this condition is true
Then, do this
Else do thatSo, that's the basis for your code. You need all three components, which you don't have in what you've posted...

Clomper,
There are a couple of folks here on this board that are more familiar with VBA but I see they must be on vacation.
If Jen's offering was not enough information then you may want to try posting at:
the OZGrid Excel/VBA forum board as they specialize in VBA and have helped me on several occaisions. They are quick too.You do need to register for free before posting. It is harmless.
Regards,
Bryan

I'm assuming you have already written the necessary code that would trigger this routine. That said, try writting your routine like so:
If ActiveSheet.Name >= "FORMMANAGER_EXPORT_XLS" Then
MsgBox "This sheet cannot be transferred."
End If
Please note the > greater-than sign in front of the = equal sign. This eliminates the need for a wildcard character. Let me know if this works.Davey

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |