Results 1 to 3 of 3

Macro loop

Threaded View

  1. #1
    Registered User
    Join Date
    07-16-2014
    Location
    USA
    MS-Off Ver
    2007
    Posts
    6

    Macro loop

    Hello, i have a macro that takes information from one tab to another that i found, and at the moment it only does it for one row. what and where do i add to it to make it do until end of table, sometimes there will be blank information (no information on other tab), or after every 15 or 17 rows (so can rewrite as needed) will be a total column, so it needs to skip these if able, but not too big of a deal. My excel macro skills are non existent at this time. macro is follows. thank you. so any and all help will be appreciated.


    Sub DataPull()
    '
    ' DataPull Macro
    ' Copy text from the "Data" sheet based on the cell to the left of the currently active cell.
    '
    ' Keyboard Shortcut: Ctrl+d
    '
    On Error GoTo DataPullError
    Dim Find As String
    Dim Cur As String
    Dim x As Long
    Dim y As Long
    
    If ActiveCell.Column = "1" Then
    MsgBox "Data macro looks up based on the cell to the left of the current cell.", vbExclamation, "Data Pull macro"
    Exit Sub
    End If
    
    Find = ActiveCell.Previous
    
    Do
    x = x + 1
    Cur = Worksheets("Data").Range("A" & x).Value
    If Cur = Find Then
    For y = 0 To 14
    Cur = Worksheets("Data").Range(Chr(66 + y) & x).Value
    If ActiveCell.Next(1, y) = "" Then ActiveCell.Next(1, y) = Cur
    Next y
    End If
    Loop Until Cur = ""
    
    Exit Sub
    DataPullError:
    MsgBox Err.Description, vbCritical, "Data Pull macro"
    End Sub
    Last edited by jstuffle; 07-16-2014 at 12:53 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Novice with VBA and macro writing needing help to loop a macro unti no data
    By jrongone in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-25-2013, 12:19 PM
  2. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  3. Macro to delete rows with a Zero value. Macro seems to be in continual loop
    By jnorri in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-07-2012, 03:20 PM
  4. Macro Loop Broken. Detects Max but doesn't continue loop
    By herchenbach in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2011, 12:17 PM
  5. Loop Macro
    By cowannbell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-15-2006, 03:23 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