+ Reply to Thread
Results 1 to 3 of 3

Writing a loop to look up data

  1. #1
    Registered User
    Join Date
    05-18-2016
    Location
    UK
    MS-Off Ver
    2013
    Posts
    11

    Writing a loop to look up data

    Hi everybody!

    For a project I am working on I am working on a rather difficult task. To put it simply: I want to write a piece of code in VBA that is able to look at a row of data, and then return the information that is provided in some of the cells (other cells are empty). I know this sounds rather vague. In the attached sheet I have added more information, and a description of how I figured out so far it should work. Is there anyone who could have a look at this and perhaps help me out with it? I think it a very complex problem and there might not be a perfect solution for it.
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,468

    Re: Writing a loop to look up data

    Looks like homework to me. What have you tried so far? The instructions say you need a loop; where's your code for the loop?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Writing a loop to look up data

    Place your data from row1 and column1 and paste this code and run the macro and tell me if it worked for you. I could not attach the excel file.
    ravisahankar
    Sub tryme()
    Dim a As Integer, b As Integer, c As Integer
    For c = 2 To Cells(Rows.Count, 1).End(xlUp).Row
    b = 1
    For a = 2 To 14
    If Cells(c, a) <> "" Then
    Cells(c, b + 14) = Cells(c, a)
    b = b + 1
    End If
    Next a
    Next c
    MsgBox "Complete"
    End Sub

+ 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. Writing to cell stops for loop
    By Amathanio in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-04-2016, 06:40 AM
  2. [SOLVED] Loop writing blank cells
    By cnash52 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 03-10-2016, 12:43 PM
  3. Problem writing a loop
    By themindseye in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-17-2014, 09:30 AM
  4. 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
  5. Need help writing Loop syntax
    By sslack88 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-26-2012, 11:02 PM
  6. Issue writing a loop
    By bg18461 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-30-2008, 08:27 AM
  7. help writing loop
    By robhargreaves in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2005, 06:05 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