+ Reply to Thread
Results 1 to 3 of 3

Using "For" with multiple inputs

  1. #1
    Registered User
    Join Date
    02-08-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Using "For" with multiple inputs

    I need a macro which goes through a series of worksheets, adding an email address to cell B1 of each sheet.

    The email address needs to be lifted from a list of email addresses which is held in a separate work sheet, so working down the list one at a time. The separate worksheet is called "Standing name data" and the list starts in cell F4. I've attempted this by doing the following:

    Sub fill2()
    Dim k As Integer
    Dim l As Integer
    k = ActiveSheet.index
    l = Worksheets.Count


    For i = ActiveSheet.index To Worksheets.Count: For j = 4 To l - k + 4


    Sheets(i).Range("B1").Value = Sheets("STANDING NAME DATA").Cells(j, 6).Value
    Next: Next


    End Sub

    The problem is that this runs the for over and over in each worksheet, so it goes across all the sheets but leaves only the final email address from my list in each sheet. Appreciate help anyone can give! Sorry if I'm being particularly simple on this!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Using "For" with multiple inputs

    Is there a single email address for each sheet starting in F4 on 'Standing name data'?

    If there is you only need one loop.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-08-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Using "For" with multiple inputs

    That's brilliant thank you - much simpler than what I was trying to do!

+ 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. [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
  3. Looping thru rows and copy cell values from "Inputs" sheet to "Output" sheet
    By hariexcel1987 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-02-2015, 11:32 PM
  4. Replies: 2
    Last Post: 06-06-2013, 12:45 PM
  5. [SOLVED] Find multiple "text" criteria and return as ""Yes" in Matrix
    By bertrand82 in forum Excel General
    Replies: 11
    Last Post: 04-30-2012, 09:20 AM
  6. Protect worksheet after user inputs value and pushes "Submit"
    By CKD777 in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 11-07-2011, 06:53 PM
  7. Replies: 1
    Last Post: 02-15-2006, 11:10 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