+ Reply to Thread
Results 1 to 6 of 6

Put starting with "X" or "3" sheet into array

  1. #1
    Registered User
    Join Date
    11-17-2017
    Location
    STREET CORDWALLIS
    MS-Off Ver
    2016
    Posts
    3

    Put starting with "X" or "3" sheet into array

    Hi all, may i have your help. details as following.

    Basically, when the sheet number change, i manually change the sheet array at vba. any good way to put the sheet which name starting with "X" or "3"

    Dim WshtNames As Variant
    WshtNames = Array("X310361", "X310377", "X310379", "X310400", "310531", "310539", "X310561", "X310579", "X310605", "310610", "310645", "310646", "310647", "310653", "X310660", "X310662", "310665")

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Put starting with "X" or "3" sheet into array

    Maybe a block of code to cycle through the sheet names that start with X or 3 and when found add them to the array.

    You could perhaps count them first and use that count to Redim the array name and then loop through the sheet names.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Put starting with "X" or "3" sheet into array

    What are you doing with the array?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    11-17-2017
    Location
    STREET CORDWALLIS
    MS-Off Ver
    2016
    Posts
    3

    Re: Put starting with "X" or "3" sheet into array

    would you provide me example, so that i can test?

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Put starting with "X" or "3" sheet into array

    Here's one way

    If you wanted to avoid the two loops you could use the Redim Preserve option in the first loop and remove the second

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-17-2017
    Location
    STREET CORDWALLIS
    MS-Off Ver
    2016
    Posts
    3

    Re: Put starting with "X" or "3" sheet into array

    Hi Richards, i put your code to new excel and start the macro but nothing show.

+ 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. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  2. Replies: 2
    Last Post: 07-24-2017, 02:19 AM
  3. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  4. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  5. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  6. Replies: 7
    Last Post: 05-13-2006, 05:02 PM
  7. If changed array formula reduce ""\""\""\ - signs to #Missing, will it make ...
    By Maria J-son in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2006, 08:25 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