+ Reply to Thread
Results 1 to 6 of 6

modify code to make i is dynamic range in code

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: modify code to make i is dynamic range in code

    the complete code as the following
    Sub loop()
    
      Dim ws As Worksheet
      Set ws = ActiveSheet
      Dim rng As Range
    
    Set rng = Sheets("sht2").Range("A15")
    
    
      Dim lastRow As Long
      lastRow = ws.Cells(ws.Rows.Count, 15).End(xlUp).Row
      
      For i = 2 To lastRow
    
    rng = Sheets("sht2").Range("O" & i)
    Call action1
    Next i
      
    End Sub

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,251

    Re: modify code to make i is dynamic range in code

    Are you trying to convince us that the procedure named 'Sub loop()' (small letter "L" in "loop") will run at all ?

+ 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. Need to modify VBA code from excel format to userform for making it more dynamic
    By Pankaj jaswani in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-13-2022, 09:21 AM
  2. VBA Code to make a dynamic data range?
    By terry3218 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-04-2019, 12:19 AM
  3. [SOLVED] Modify the code to make it copy more than one line....
    By raghuprabhu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-07-2017, 03:11 AM
  4. [SOLVED] assistance to make a vba code run on a dynamic range
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-16-2017, 12:33 AM
  5. [SOLVED] My code is not dynamic; it has a pre-defined range. Possible to change code?
    By mick0005 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-20-2015, 10:23 PM
  6. [SOLVED] Modify the Code to Make It Do the Same Thing for More Columns
    By aviatecar in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-24-2014, 02:12 PM
  7. Recorded Code/Modify/Convert Range to Dynamic
    By nuttycongo123 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-08-2011, 08:35 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