+ Reply to Thread
Results 1 to 3 of 3

For Each Looping

Hybrid View

  1. #1
    Registered User
    Join Date
    04-29-2014
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    15

    For Each Looping

    I am trying to update some cells for all rows that have the same value in the cLagNum range. Right now when I tell it to update, it only updates the current row. I'm not sure why it doesn't seem to be looping. Any ideas or suggestions would be appreciated.

    For Each e In Worksheets("Summary").Range("cLagNum").Cells
        If e = TextBox2.Value Then
            e.Offset(0, -21).Value = Me.ComboBox15.Value
            e.Offset(0, -20).Value = Me.ComboBox16.Value
            e.Offset(0, -19).Value = Me.ComboBox17.Value
            e.Offset(0, -18).Value = Me.ComboBox1.Value
            e.Offset(0, -17).Value = Me.ComboBox19.Value
            e.Offset(0, -16).Value = Me.ComboBox8.Value
            e.Offset(0, -15).Value = Me.ComboBox7.Value
            e.Offset(0, -14).Value = Me.ComboBox2.Value
            e.Offset(0, -13).Value = Me.ComboBox4.Value
            e.Offset(0, -12).Value = Me.ComboBox3.Value
            e.Offset(0, -11).Value = Me.ComboBox6.Value
            e.Offset(0, -10).Value = Me.ComboBox5.Value
            e.Offset(0, -3).Value = Me.ComboBox20.Value
            e.Offset(0, -2).Value = Me.ComboBox18.Value
            e.Offset(0, 0).Value = Me.TextBox2.Value
        End If
    Next e

  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: For Each Looping

    Hi,

    What does Range("cLagNum") evaluate to? i.e in the Immediate window once you've stepped into the macro what do you get with

    Print Range("cLagNum").Address
    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
    Registered User
    Join Date
    04-29-2014
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: For Each Looping

    It's giving me $V$2:$V$142. (It's a dynamic named range).

+ 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. Looping Help
    By bennettair193 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2013, 01:02 AM
  2. Do Until Looping (not looping through all other columns)
    By orle8050 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2013, 10:37 AM
  3. Looping
    By Nordeen1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2012, 12:31 PM
  4. Looping
    By Baziwan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-21-2010, 01:05 PM
  5. Little Looping
    By Stuie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-18-2006, 06:14 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