+ Reply to Thread
Results 1 to 4 of 4

Run a for loop from another sheet

  1. #1
    Registered User
    Join Date
    09-09-2021
    Location
    Stockholm, Sweden
    MS-Off Ver
    365 MSO 64 bits Excel version 1910
    Posts
    11

    Run a for loop from another sheet

    Hi

    I thought this was going to be easy but I am stuck.

    I want to execute a for loop from one sheet, going through data in another sheet. I have tried to set the sheet to be looped as active but my loop only looks in the sheet I am executing the loop from. how do I do this?

    this is my code (simplyfied). sub cmd_load_click is located in sheet "summary. same workbook.

    Private Sub Cmd_load_Click()

    Dim i As Integer


    Worksheets("IT").Activate

    For i = 1 To 7
    MsgBox (Cells(i, 1))
    Next i


    End Sub

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Run a for loop from another sheet

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    09-09-2021
    Location
    Stockholm, Sweden
    MS-Off Ver
    365 MSO 64 bits Excel version 1910
    Posts
    11

    Re: Run a for loop from another sheet

    works perfect. thank you!!

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Run a for loop from another sheet

    You are very welcome.

+ 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] VBA code to copy and paste data in one sheet from multiple sheet and loop through
    By Farhasnat in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-24-2021, 07:11 AM
  2. [SOLVED] Code to loop through input sheet and whenever a cell matches copy to a new sheet
    By wolfdemon in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-19-2021, 02:15 AM
  3. excel loop to copy data from sheet 1 to sheet 2 based on matches
    By vpan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2021, 07:46 PM
  4. [SOLVED] (Beginner help) For loop inside do loop that displays information from reference sheet.
    By lediable007 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-08-2016, 03:20 PM
  5. Replies: 3
    Last Post: 11-06-2014, 01:23 AM
  6. [SOLVED] Loop through sheets - pick up formula from same cells each sheet into summary sheet
    By Webbo in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-07-2013, 01:43 PM
  7. [SOLVED] Loop till end of the sheet and loop back to first column again
    By smlim7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2012, 10:03 AM

Tags for this Thread

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