+ Reply to Thread
Results 1 to 4 of 4

For Each Worksheet containing 'XXX'

  1. #1
    Forum Contributor
    Join Date
    01-21-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    258

    For Each Worksheet containing 'XXX'

    Good Afternoon Folks.

    I was wondering how I could write a line that will loop through my worksheets containing 'XXX' in their name.

    Currently I have this line

    Please Login or Register  to view this content.
    Which doesn't work. The rest of the code works fine, it just runs it on every sheet including the ones that dont include 'XXX' in their name.

    any ideas how to solve this?

    Many Thanks,

    R

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: For Each Worksheet containing 'XXX'

    try
    Please Login or Register  to view this content.

    e/ = 0 would imply that instr returned nothing
    Last edited by Solus Rankin; 10-25-2013 at 09:21 AM. Reason: misread OP
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: For Each Worksheet containing 'XXX'

    I think you want:
    Please Login or Register  to view this content.
    For what it's worth:
    InStr Function


    Returns a Variant (Long) specifying the position of the first occurrence of one string within another.

    Syntax

    InStr([start, ]string1, string2[, compare])

    The InStr function syntax has these arguments:

    Part Description
    start Optional. Numeric expression that sets the starting position for each search. If omitted, search begins at the first character position. If start contains Null, an error occurs. The start argument is required if compare is specified.
    string1 Required. String expression being searched.
    string2 Required. String expression sought.
    compare Optional. Specifies the type of string comparison. If compare is Null, an error occurs. If compare is omitted, the Option Compare setting determines the type of comparison. Specify a valid LCID (LocaleID) to use locale-specific rules in the comparison.
    Last edited by ragulduy; 10-25-2013 at 09:24 AM.

  4. #4
    Forum Contributor
    Join Date
    01-21-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    258

    Re: For Each Worksheet containing 'XXX'

    You Guys...I Love You Guys.

    http://www.youtube.com/watch?v=IjY8_z3QoSQ

    Reap Your Reward

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Merge multiple worksheet to summary worksheet based on column header value match
    By rafiomeon in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-23-2012, 03:37 AM
  2. Excel VBA find newest worksheet based on date/time stamp in worksheet name?
    By takchin.tc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-27-2012, 03:56 PM
  3. [SOLVED] Copy data from a worksheet and paste to worksheet with a similar worksheet name
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-21-2012, 04:02 AM
  4. Copy data from a worksheet and paste to worksheet with a similar worksheet name
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-21-2012, 02:49 AM
  5. Replies: 3
    Last Post: 10-16-2012, 09:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1