excel vba - Delete sheet if cell content doesn't match a list value -


I am hiding for months learning VBA to help automate some reports for my job and I Finally one thing is that we are completely trapped and I do not get an answer online.

I have an automatically generated report that has a separate sheet for each person in the company. I will not have a fixed file name to some extent, so I think I want something:

  to this extent, the string will be slowed as thiswb = activworkbook.name  

what I would like to do, for each sheet in this sheet, In 4 the name of a cell does not match any name that I have any other Saved in the address book (it has been left with a workbook with is a constant name "jobs report does not change"), deleted sheet so finally I separate sheet for each name on your list.

Any help would be appreciated. Let me know if you need any more info.

Before using this code, copy the list of your list from "Job Report" in your To-do list. Please. This macro is cycled through each sheet in the workbook, and uses the FIND to identify whether the name is anywhere on a tab named "staffnames"

"lang-vb prettyprint-override"> Worksheet Dim RNG as a Focus Focus Cypher Focus in CIFEET sheet as the range for each focus. Set RNG = Set Sheets ("Staff Names"). Range ("C4"), LookIn: = xlValues) If Focus_SEEET.Name = "staffnames" then 'Skip to Employee List' Nothing 'Message' ("Skip" and Focus_HEET.Name) ElseIf No Rng Nothing 'Nothing' in the list 'Nothing' messagebox ("found" and range ("C4")) Other: Delete 'name not found' tab on 'list unknown name:' and ("C4") tab Application.DisplayAlerts = False focus_SHEET.Delete application.DisplayAlerts = True End if the next focus is set to IHETT Focus_sFET = nothing set RNGE = nothing end You can also add more features that automatically open the source of your staff's names but you should move it in the right direction.

< / Html>

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -