Closed Thread
Results 1 to 3 of 3

Dynamic Macro Starting Point

  1. #1
    Forum Contributor
    Join Date
    01-29-2015
    Location
    .
    MS-Off Ver
    2010
    Posts
    313

    Dynamic Macro Starting Point

    Could someone tell me why my macro isnt running correctly? The macro is suppose start runnning 4 rows down after it finds the cell with the word "components" but I think its trying to run on the row directly after the row that contains the cell with the word components?

    Please Login or Register  to view this content.
    Public Sub ZS1LOSTL_TREE_breakDown2()
    Dim i As Long, j As Long, Rw As Long
    Dim offset As Object

    Application.ScreenUpdating = False
    With ActiveSheet
    Rw = .Cells.Find("Components", LookIn:=xlValues, LookAt:=xlWhole).Row + 1
    For i = Rw To .Cells(Rows.Count, 1).End(xlUp).Row
    'offset = .Cells(i, 1)
    If .Cells(i, 1) <> "" Then
    For j = Cells(i, 1).Value To .UsedRange.Columns.Count
    If .Cells(i, j + 1) <> "" Then
    .Cells(i, 2) = .Cells(i, j + 1)
    Exit For
    End If
    Next j
    End If
    ' .Cells(i, 2).Value = .Cells(i, 2 + offset)
    Next i
    End With

    Application.ScreenUpdating = True
    End Sub
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Dynamic Macro Starting Point

    The code is doing what it is supposed to.
    Please Login or Register  to view this content.
    Finds the row with "Components" +1, which means the next row.

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Dynamic Macro Starting Point

    Again:

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    AND




    , unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dynamic starting point
    By scarlettw123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-30-2015, 06:22 AM
  2. [SOLVED] Need help on setting starting point of macro
    By techrcn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-30-2013, 01:12 PM
  3. Using pop-up box as starting point for rest of macro
    By tripkane in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2012, 07:37 PM
  4. Replies: 3
    Last Post: 08-19-2005, 09:05 AM
  5. Starting Point of macro
    By Turin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-07-2005, 08:05 AM

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