473,626 Members | 3,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1595
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.comwr ote in message
news:11******** *************@b 28g2000cwb.goog legroups.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,sheetR ange,"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.comwr ote in message
news:11******** *************@b 28g2000cwb.goog legroups.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
2433
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 character searched for, my pagination routine doesn't pass the correct value. Say the user enters %300. The page displays the correct data for the first page, indicates that it is page 1 of 11 and when the NEXT link is clicked, the value changes to...
5
7408
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 (using LIKE and "%" and "?"). But is it possible to match a concrete string against a database of wildcarded data? ("%" and LIKE do not work). For example: CREATE TABLE blacklist (
1
3221
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 maps. I have come up with two approaches, one using inheritance and the other using composition. I am unable to decide which one is better. The sample source code follows.
1
7261
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 database field containing "somestring". Is there a way to avoid the need for the asterisks? This would make it easier for the users and also I wouldn't have to explain that asterisks are required when performing a wildcard search.
2
1987
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 String = "SELECT ProductID, ProductName FROM Products WHERE ProductName LIKE '%prod%'" but it is not working. If I use the query this way(as given below) it works but I want to use
2
1667
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 other is a String. Currently they both work as I like and I can get my data as I want. What I'm intersted in is seeing HOW I do a Global search for both cases. Here are my two issues: ISSUE 1:
3
2260
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, but I probably have not properly implemented the solutions I find. I am trying to make a page to allow personnel the ability to search our backend DB (which is Ingres 2.0) through a web interface. Ingres has a cgi program called ICE that can...
21
3454
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 ;-) I can't seem to find a wild card that will work in VB 6. in spl advantage Ic an ue a 'Sam%' to find all Sam(s) and '%Sam' for Sam like, Example Samuel would show up here. Is there such a thing in VB 6, recent searches and reading hve come up...
0
2665
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 some code which will allow me to do it but i dont know how to change the code. Could someone please help me. I have added the code for you to. function MyQuery::OnClick(eventObj) { // Get the default SQL command for the form. var...
0
8272
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8205
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8713
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8644
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8370
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7206
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1516
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.