Results 1 to 3 of 3

Dynamic Range in For Loop

Threaded View

phbryan Dynamic Range in For Loop 11-16-2022, 05:06 PM
Crooza Re: Dynamic Range in For Loop 11-17-2022, 03:31 AM
BadlySpelledBuoy Re: Dynamic Range in For Loop 11-17-2022, 03:35 AM
  1. #1
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    236

    Dynamic Range in For Loop

    Hello,

    I have the below code:
    Sub GoalSeekMultipleCells()
    Dim StartDate As Date
    Dim Find As Range
    Dim ReqSheet As Worksheet
    
    
    Set ReqSheet = Worksheets("REQ SHEET")
    StartDate = ReqSheet.Range("D1").Value
    Set Find = ReqSheet.Range("A3:AH3").Find(What:=StartDate)
    
    For p = 4 To 30
    Cells(p, "t").ClearContents
    If Cells(p, "x") < Range("X2").Value Then
    On Error Resume Next
    Cells(p, "t").Value = Cells(p, "i").Value * Range("X2").Value - Cells(p, "w").Value
    Cells(p, "t").Value = Round(Cells(p, "t").Value, 0)
    End If
    Next p
    End Sub
    This code works fine in the set ranges of T4:T30, W4:W30, and X4:X30 but now I would like to make these ranges dynamic.
    For example, based on the Date in D1, find that date in Row 3, and work in that area. Would this be possible using Offset?
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Setting Dynamic Loop Range
    By radddogg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2017, 12:13 PM
  2. Filling Comboboxes with a loop from a dynamic range
    By dougman824 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2017, 10:03 AM
  3. [SOLVED] Loop through a dynamic range.
    By Sluggoslabang in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 09-06-2016, 02:41 PM
  4. [SOLVED] Dynamic range in a loop
    By trailonu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2015, 07:22 PM
  5. [SOLVED] Merge Cells in Dynamic Range using For loop
    By crazymazy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2013, 11:33 AM
  6. VBA Plot Multiple Charts Using Loop Through Dynamic Range
    By sanjeevpandey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2013, 07:38 AM
  7. Loop with dynamic range
    By mthomas in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-22-2011, 10:35 PM

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