Close Filename With Wildcard

Jun 22, 2006

I'm trying to close files which satisfy the criteria that the filename contains the word "monthlyreport". I tried the code below what it doesn't work at all. I'm also hoping in the future I can add on other criteria, e.g. contains the word 'monthly report' or starts with 's', maybe another If in the code? I'm really not sure..

Sub Close()
Dim wbMonth As Workbook
If wbMonth. Name Like "*monthlyreport*" Then
wbMonth.Close False

End If
End Sub

View 5 Replies


ADVERTISEMENT

Filesearch Filename Wildcard Before Specified Keywords

Jan 17, 2007

I've gotten the Filesearch function to work in VBA when using a wildcard after the keywords like this: "SomeFile*.xls".

But I can't get it to work with keywords after the wildcard character like this: "*someFile.xls"

View 3 Replies View Related

Compile Error On Close Of Excel 2003 But Not On Close Of Workbook

Mar 22, 2012

I am using Excel 2003.

It’s been working perfectly up until around an hour ago. However, now when I close Excel, I get compile errors.

These compile errors seem to be because Excel is trying to access controls in the workbook after it has closed. Since the workbook is closed, VBA can no longer ‘see’ the controls, and therefore it thows up errors.

I’m also getting a similar error on a Worksheets("DataExplorer").unprotect line, which seems to be because the worksheet isn’t there after closing.

These errors only occur when I close the whole excel application using the big cross in the top right. If I just close the workbook (using the smaller cross just below the big cross in the top right of excel), it doesn’t throw up these errors.

Just to clarify: all of the code runs perfectly when Excel is open. The errors are being thrown up for lines of code which run without problem until Excel is closed.

View 9 Replies View Related

Amending The Filename In Cell("filename")

Jul 7, 2006

I am trying to display the Filename in a cell on my worksheet. However, when I enter the =Cell("filename"), it provides the full path (C:/Documents......Cost Summary.xls) How can I display only the filename without the path?

View 3 Replies View Related

Disabling "x" To Close & Creating Macro Button To Close

Oct 11, 2006

I need to know the command to close a workbook. I have used the information found here: http://www.ozgrid.com/VBA/userform-close.htm to disable closing the workbook via the upper right "X", but I need a button that, when clicked, simply closes the workbook instead.

View 2 Replies View Related

If Then Using Wildcard

Feb 21, 2009

Have a cell that says something like "123 main street".

I want the cell next to it to = Main if it detects main in the other cell and if not then it should say no. I tried this.

=if(B2="*main","Main","No"

However, it is not working.

View 9 Replies View Related

Wildcard

Jun 7, 2006

I transferring data from the mainframe and some data has ????. I can not replace them with something else because excel think it is wildcard. The reason for this request is I was trying to count the number of cells that has ???? and the count was something different each time. If you want to have fun try it out. It will count ?, ??, ??? but not ????.However my question would be how to change this (????) to some thing like unknown...

For Each rngC In rngJbn
rngC = Trim(rngC)
If rngC.Value <> newvalue And rngC.Value <> "ab-" Then
'MsgBox "****" & rngC & "***"
Résultat = Application.CountIf(Range("C2:C" & Range("C" & Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeVisible), rngC)

MsgBox rngC & " " & Résultat & " " & i
End If
newvalue = rngC.Value
Next

View 6 Replies View Related

Use The Wildcard In An IF Formula

Nov 13, 2008

Is it possible to use the wildcard in an IF formula? For instance, I have a spreadsheet with text and numbers in the cells, the number of characters varies in the cells so a left, right or mid is out. I want the formula to look to the cell and if any part of the text contains "ABC" then I want to return 1. =IF(C18="*ABC*",1,"") Cell C18 containts the letters ABC in order but my formula is still returning blanks?

View 4 Replies View Related

Hyperlink With Wildcard

Aug 3, 2013

The idea

[Code] .....

Dropdown list
-------------
O11 = "Land" , "Sea"
P11 = "A - H" , "I - O" , P - Z"

Directory = C:MammalsLandA - HDate_120313 - Carnivore - Code_A3622

The list of filenames in the "A-H" folder has different dates and codes, how do I go about fixing wildcard *Carnivore* so that regardless of the date and code, there will be a match.

list of files in A-H folder
------------------------
Date_120313 - Carnivore - Code_A3622
Date_030213 - Herbivore - Code_A2231
Date_051212 - Hybrid - Code_A4431

View 10 Replies View Related

Wildcard In IF Statement

Jun 23, 2014

How to use this wildcard in a IF statement.

[Code] ......

I have a column I'm adding a value to another cell if a piece of text is found in the column I'm looking in. The * is not working at all.

View 2 Replies View Related

Turn Off * As A Wildcard

Aug 28, 2007

The use of * as a wildcard in excel can be extremely useful, however, can it be turned off? I work in the education sector and am currently number crunching GCSE results. When it comes to calculating A* grades versus A grades, B grades, etc, I cannot seem to do it because of the wildcard.

View 12 Replies View Related

Wildcard Incorrect

Dec 7, 2007

I have tried everything I can think of to get this to work.

I am searching column B for anything containing "Tease", then if found, look to see if column J contains a "W".

Excel doesn't report an error, but this doesn't work:

=SUMPRODUCT((B3:B40="*Tease*")*(J3:J40="W"))

View 10 Replies View Related

Formula Wildcard

May 1, 2009

Hi I have this formula:

View 3 Replies View Related

Can Wildcard Be Used In If Statement

Oct 31, 2011

As far as I know, a wildcard can't be used in an "if" statement. I have a list of "job names" that vary slightly from time to time. When we use a Bunnings "(building account) people give a job name such as "121 William Drive". Sometimes however, the person in the store spells it incorrectly. Is there a way to find a wildcard in the following manner?

Find any word that begins with "121" and ends in "ve"

In a1 it says: "121 wilaim jnes drive" I have tried the following formula in b1:

=IF(a1="121*ve","yes","no")

Why does it say "no"? Is there a formula for using wildcards in an "if" statement?

View 2 Replies View Related

VBA Countif With Wildcard

May 15, 2012

Trying to count how many cells in column b contain a value.

using

Application.WorksheetFunction.CountIf(Range("B:B"), "" * "")

getting a type mismatch error.

View 2 Replies View Related

Lookup With Wildcard

Mar 27, 2014

I was wondering is there away where i can lookup A:A anything begging with Ves* ? and then i need to copy the formula down to pick up the next one in the list

im guessing something like =VLOOKUP(A:A,"Ves*") but i havent got a clue

View 1 Replies View Related

SQL WILDCARD In Column NAME

Feb 18, 2009

In a recent thread, I learnt how to import HTML, using ADO into Excel.

To import the relevant variables, my code is as below: ...

View 9 Replies View Related

If Statement With Vlookup And Wildcard

Jan 7, 2014

I need to lookup data from four different columns to match a value in another sheet. The lookup value has to start with "4" in order for it to be the correct match. I've tried the following formula for just two columns:

=IF(VLOOKUP($C2,'Sheet 1'!$D$2:$H$10000,5,FALSE)="4*",VLOOKUP($C2,'Sheet 1'!$D$2:$H$10000,5,FALSE),IF(VLOOKUP($C2,'Sheet 2'!$E$2:$G$10000,3,FALSE)="4*", VLOOKUP($C2,'Sheet 2'!$E$2:$G$10000,3,FALSE),"False"))

The problem I have is that the wildcard function isn't working in my If statement (apparentley that's how Excel was designed). The first vlookup returns the value "40042565" but Excel doesn't show it matching the criteria with the wildcard ("4*").

Any way to lookup the value in C2, search through multiple columns, and return the value that starts with "4"?

View 3 Replies View Related

Wildcard Filtering/sorting

Feb 5, 2010

We have an ISP based antispam system which can sometimes incorrectly pickup messages as Spam. I would like to scan through all quarantined messages every week to check that this does not happen. I can export a report from the program to excel but what I would like to do is remove subject lines with common spam words (Viagra, Russian etc) so I don’t need to check these, this would in effect reduce the report by 85%.

Ideally the ‘spam word’ list would be on the second sheet as in example and could be added to as I find obvious words.

The ideal end result would either be all lines which have a word from the ‘Spamwords’ sheet are removed or all lines which do not match the words in the spam list are copied to a new sheet.

View 8 Replies View Related

Extract From String Using Wildcard ..

May 14, 2009

I've this question, how do i extract a part of the text using wildcard(example "ID=") in the string in the whole columns and copy to other columns or delete the unwanted.

Below is a example which i create for better understanding.

View 11 Replies View Related

Use Of Wildcard In Cell Formula

Feb 8, 2009

I'm trying to use a "WildCard" in an Array Formula to both simplify and handle variations in several formulas.

My work sheet is used for Time Cards. I have a tab for each of the 52 weeks in the year and each tab is labeled "W1", "W2" for Week 1, Week 2, etc.

On my SUMMARY tab, I'm using an array formula that looks at cell "'SUMMARY'!D6" for a project number, and than searches through all of the Week Tabs for anyone that has charged time against that project.

The employee would enter the project number in D12:D35 of a given weeks tab with each row representing a different task for that week. In some cases they may have several rows for the same project number.

On the SUMMARY tab, the formula for Week 1 is in cell E6. For Week 2 it's in F6, etc.

I was thinking I could simply place the sheet tab name in the row above (i.e. D5, E5, F5, etc., and then write the formula for 1 cell and copy it to all of the other cells on that row.

Currently my formula looks like:
{=IF($D$6="","",SUM(IF('W1'!$D$12:$D35=$D6,('W1'!$N$12:$N$35))))}

I was thinking the formula might look like:
{=IF($D$6="","",SUM(IF('&E5&'!$D$12:$D35=$D6,('&E5&'!$N$12:$N$35))))}

But that isn't working.

Additionally I was hoping to do something similar on the SUMMARY tab by referencing a different spreadsheet with something like:
='[&A1&]Sheet1'!$B$51
Where cell A1 has the value "Time Sheets - 01-17-09.xls"Currently the formula looks like:
='[Time Sheets - 01-17-09.xls]Sheet1'!$B$51

But this isn't working either.

View 10 Replies View Related

Advanced Countif With Wildcard

Mar 31, 2009

I've been looking around for a way to use the countif function in excel with a wildcard, I have a excel list with a column containing data which looks like: ....

View 12 Replies View Related

Using Wildcard In VBA Countif Function

Nov 5, 2011

I am trying to return how many cells contain a string of text as entered by the user but I am struggling to put wildcards around my search term. Below is the code I have so far.

Code:
Dim search as String
Dim occurance As Integer

search = InputBox("Search for", "Search Term")
occurance = WorksheetFunction.CountIf(Cells, search)

MsgBox (occurance)

View 2 Replies View Related

Search Using Wildcard In Macro

Dec 29, 2011

I have a spreadsheet where there are lines of different Wage Types but only certain combinations are needed. For example I have Pay Area 1234 which needs all wage types except those beginning with a 9.

To do this I have set up Sheet1 to look like this:

12341
12342
12343
12344
12345
12346
12347
12348

and not 12349 as I do not require this type.

The problem here is I need to add a wildcard to the end of these so it finds anything that starts with 12341 etc.

Sheet1 contains the personal details of employees and I have concatenated the Payroll Area and Wage type in column D.

Code:

Sub deleterows()
Application.ScreenUpdating = False
Set MySheet = Sheets("data")
LR = MySheet.Cells(Rows.Count, "D").End(xlUp).Row
For i = LR To 2 Step -1

[Code]...

View 9 Replies View Related

Excel Lookup With Wildcard?

Jun 20, 2012

I maintain a control list of all properties held by the company. Each month I have to manually review all property-related transactions (see transaction description column) and input in column "Key 1" the property it relates to by reviewing the data in the transaction description and finding the property in the control list. Is there a way I can automate this process with a forumla?

some key points:
- the name in the control list can appear at any positiion in the transaction description
- various transactions relating to the same property will appear in the transaction description listing many times and key 1 will need to be completed against each entry
- if there is no match between the transaction descripton and the control list then the relevant cell in column "Key 1" should show as "Not Found"

Control List
Transaction Description
Key 1
Bligh

[Code].....

View 5 Replies View Related

VLookup Of Concatenate With Wildcard

Jan 31, 2014

I would like to Vlookup an association of data in a matrix where not all information is available. e.g:

Vlookup of following data (concatenate):

A1&B1&C1&D1
A2&B2&C2&D2
A3&B3&C3&D3

but in the mapping I would have a wild card (*) in certain columns (not always the same column)

The concatenate would be for exemple:

A1&*&C1&D1
A2&B2&*&D2
*&B3&C3&*

I know it works on the other way around (Vlookup of concatenate with wilrdcards) but I can not have wildcards in my source data.

View 7 Replies View Related

Open File Using A Wildcard

Mar 7, 2007

Currently I have some code in a macro that opens a file like so -

Dim theDate As Date, thePath As String, wb As Workbook
theDate = Sheets("ActiveDon").Range("Eventdate").Value
thePath = "C:PROJECT" & Format(theDate, "MM-YY") & " xxx Data.xls"
Set wb = Workbooks.Open(thePath)

This works swell if the file is, say "01-07 xxx Data", but in truth the xxx is variable (but there's always only one). I'd like to make

thePath = "C:PROJECT" & Format(theDate, "MM-YY") & "*wildcard*" & " Data.xls"

so that it will open the file whether it's called "01-07 CA Data.xls" or "01-07 MA Data.xls", or whatever.

Is it possible to use wildcards to do this?

View 9 Replies View Related

Importing .txt File With Wildcard

Sep 10, 2007

I am trying to create a macro that imports a text file that has a changing name (it has date/time info in it). The file name will have some consistent parts and the rest I hope to be able to use wildcards on. In the code below, the path will be constant and the file name will always have "Heavy Water" in it. How can I change the code to import any version of the file?

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:UsersG-MoneyDocumentsEVElogsMarketlogsThe Forge-Heavy Water-2007.09.09 184540.txt" _
, Destination:=Range("$A$1"))
.Name = "The Forge-Heavy Water-2007.09.09 184540"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells

View 9 Replies View Related

Using Wildcard Characters In IF -THEN Statement

Oct 22, 2007

I'm trying to create 2 separate data sets based on year (06 vs. 07). To do so, I created a column and created an if then statement that populates with Yes If the date value is "like" 2006". Excel didn't like the ? or asterik. Is there some other syntax that will accomplish.

While I open to other approaches for filtering these 2 data sets, Ive been wondering for awhile about excel and wildcard logic.

View 9 Replies View Related

Wildcard For Text In Sumproduct

Aug 14, 2008

Tring to get the following spread sheet to calc column C using two criteria
Criteria 1 Column D must contain HC Investor anywhere
Criteria 2 Column A must be less than Reimbrusement - 11
The following formula in G2 appears to have an error in criteria 1 ....

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved