473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

wildcard searches

I'm currently tearing my hair out on this one. I'm trying to run
through a bunch of worksheets in a bunch of workbooks and only run an
import on the ones that match the type of name I'm looking for.

I thought it would be a simple matter of:

sheetRange = xlSheet.Name

If sheetRange = "AOD*" Then

Do
--
--
--

So what happens if I print out the sheetrange is it says AODblahblah
but will not go into the if statment, is this not a wildcard? I have
declared sheetrange to be both a variant and a string but it doesn't
seem to make any difference.

Any help would be much appreciated, surely it can't really be as hard
as I'm making it?

Thanks

Jul 10 '06 #1
4 1572
Try changing you statement to LIKE rather than =

If xlSheet.Name equals AODblahblah, it doesn't equal AOD*, it is like AOD*

IF SheetRange like "AOD*" then......

Mark

<ma****************@lmco.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
I'm currently tearing my hair out on this one. I'm trying to run
through a bunch of worksheets in a bunch of workbooks and only run an
import on the ones that match the type of name I'm looking for.

I thought it would be a simple matter of:

sheetRange = xlSheet.Name

If sheetRange = "AOD*" Then

Do
--
--
--

So what happens if I print out the sheetrange is it says AODblahblah
but will not go into the if statment, is this not a wildcard? I have
declared sheetrange to be both a variant and a string but it doesn't
seem to make any difference.

Any help would be much appreciated, surely it can't really be as hard
as I'm making it?

Thanks

Jul 10 '06 #2
ma****************@lmco.com wrote:
I'm currently tearing my hair out on this one. I'm trying to run
through a bunch of worksheets in a bunch of workbooks and only run an
import on the ones that match the type of name I'm looking for.

I thought it would be a simple matter of:

sheetRange = xlSheet.Name

If sheetRange = "AOD*" Then

Do
--
--
--

So what happens if I print out the sheetrange is it says AODblahblah
but will not go into the if statment, is this not a wildcard? I have
declared sheetrange to be both a variant and a string but it doesn't
seem to make any difference.

Any help would be much appreciated, surely it can't really be as hard
as I'm making it?

Thanks
If AOD is a constant value then
If Left(sheetrange,3) = "AOD" then

If it is a variable then...
Dim strName As String
strName = "AOD"
If Left(sheetrange,len(strName)) = strName then
Jul 10 '06 #3
Hi Madeleine,

Tried: IF (InStr(1,sheetRange,"AOD") 0 ) then ...?

HBInc.
ma****************@lmco.com wrote:
I'm currently tearing my hair out on this one. I'm trying to run
through a bunch of worksheets in a bunch of workbooks and only run an
import on the ones that match the type of name I'm looking for.

I thought it would be a simple matter of:

sheetRange = xlSheet.Name

If sheetRange = "AOD*" Then

Do
--
--
--

So what happens if I print out the sheetrange is it says AODblahblah
but will not go into the if statment, is this not a wildcard? I have
declared sheetrange to be both a variant and a string but it doesn't
seem to make any difference.

Any help would be much appreciated, surely it can't really be as hard
as I'm making it?

Thanks
Jul 11 '06 #4
That was perfect thanks very much, worked a charm.

Mark Reed wrote:
Try changing you statement to LIKE rather than =

If xlSheet.Name equals AODblahblah, it doesn't equal AOD*, it is like AOD*

IF SheetRange like "AOD*" then......

Mark

<ma****************@lmco.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
I'm currently tearing my hair out on this one. I'm trying to run
through a bunch of worksheets in a bunch of workbooks and only run an
import on the ones that match the type of name I'm looking for.

I thought it would be a simple matter of:

sheetRange = xlSheet.Name

If sheetRange = "AOD*" Then

Do
--
--
--

So what happens if I print out the sheetrange is it says AODblahblah
but will not go into the if statment, is this not a wildcard? I have
declared sheetrange to be both a variant and a string but it doesn't
seem to make any difference.

Any help would be much appreciated, surely it can't really be as hard
as I'm making it?

Thanks
Jul 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: redneck_kiwi | last post by:
I have a search feature where users can search a database. All works very well except for one small annoying bug. If a user searches for anything using wildcards and the '%' is the FIRST...
5
by: Robert Brown | last post by:
I have researched newsgroups and the web very thoroughly and unsuccessfully for a solution to what I believe is a very common problem. I know it's easy to do wildcard match against data in DB...
1
by: Generic Usenet Account | last post by:
Here's the requirement that I am trying to satisfy: Handle wildcards in STL such that the wildcard entry is encountered before non-wildcard entries while traversing containers like sets and...
1
by: deko | last post by:
I have a form where users can enter a string with asterisks to perform a wildcard search. Currently, the string entered by the user looks like this: *somestring* The purpose is to match any...
2
by: MB | last post by:
Hi, I am using a datagrid and the datagrid is filled through the SQL query. The SQL query searches for the match in the database. The SQL Query that i am writing is as follows Dim selprod As...
2
by: JohnT | last post by:
Okay... I'm using VB.net (2003) and I am accessing an MS Access DB file. I have two DataAdapters that I use to search for specific info. The two of them are similar except one is a Date, the...
3
by: george.lengel | last post by:
Hello experts, I have been struggling for days to solve this problem and every suggestion I find via Google does not work for me. There is probably a solution out there that will do what I want,...
21
Dököll
by: Dököll | last post by:
Greetings Again, All! I know a bit more of the back end of things than front. Every now and then I use wildcard to retrieve data via sql advantage, oracle, and of course, our beloved MS Access...
0
by: savage678 | last post by:
Hi Everyone, I am new to this forum and am i dire need of some help. I am trying to use wildcard searches in infopath. I have it connected to an access database using data connection. I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.