+ Reply to Thread
Results 1 to 2 of 2

Loop through a set number of sheets starting with inputted initial sheet name

  1. #1
    Registered User
    Join Date
    02-13-2019
    Location
    canada
    MS-Off Ver
    2010
    Posts
    56

    Loop through a set number of sheets starting with inputted initial sheet name

    I am trying to set the following piece of code to be able to loop through a set of sheets starting with Date1 (inputted from active worksheet), and continuing for the duration of the Result. An example would be Date1: 03-03-2022, Result: 8, For statement would start on the workbook at 03-03-2022 and copy the date for the next 8 sheets.


    Please Login or Register  to view this content.
    https://www.mrexcel.com/board/thread...-name.1199307/

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Loop through a set number of sheets starting with inputted initial sheet name

    Date1: 03-03-2022 has a numeric value of 44623, so the line
    For i = Date1 To Result
    compiles to
    For i = 44623 To 8
    and the loop won't execute. also
    .Value = CStr(wb2.Worksheets(i).Name)
    results in
    .Value = CStr(wb2.Worksheets(44623).Name)
    So change to
    For i = 1 To Result
    Ben Van Johnson

+ 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. [SOLVED] Sum of units over a time period starting with initial units and a known growth rate
    By MMMMMMMMMJ in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-15-2021, 03:34 AM
  2. Display any number of table rows starting on another sheets predefined row
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-22-2018, 04:28 PM
  3. Replies: 11
    Last Post: 09-01-2016, 04:45 AM
  4. Get column and first cell of inputted range to increment off of in FOR loop
    By dougmcc1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2015, 09:24 PM
  5. Replies: 4
    Last Post: 06-03-2015, 06:00 AM
  6. [SOLVED] Create a Drop down that will list all names starting with initial letter of names.
    By blue leader in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 01-16-2014, 03:58 PM
  7. Replies: 5
    Last Post: 09-27-2012, 07:30 PM

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