+ Reply to Thread
Results 1 to 5 of 5

repeating macro column by column until it hits a blank

  1. #1
    Registered User
    Join Date
    02-21-2014
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    21

    repeating macro column by column until it hits a blank

    Hello and thanks for helping.

    This is for a template for teachers to analyze student testing data. On sheet4, wrong answers in each column are noted by a lack of a + in the corresponding cell. I want to paste the names of the students who missed each question into sheet 5.

    I've done it by repeating a filter macro, but I manually copied the following separately for the 75 columns in the template

    Please Login or Register  to view this content.

    Problem #1 - there must be a more efficient code, something that automatically loops to the next column

    Problem #2 - the template has 75 columns, but many tests have fewer questions. I'm trying to find a way to stop the loop whenever it hits a blank cell in Row 10 on sheet 4. I've done it with an if/then in the last section on the above code, but where I'm at now, i would have to add that to the code section for each column. Which isn't that big a deal, but I figure there must be a better way.

    If you've time to help, I appreciate it much.

    The relevant portions of the workbook are attached here.

    repeating macro until hits blank cell sample.xlsm

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: repeating macro column by column until it hits a blank

    try the following macro
    Please Login or Register  to view this content.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    02-21-2014
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: repeating macro column by column until it hits a blank

    Thanks so much for responding (And sorry for the delay, I got diverted by other projects until today).

    Your code worked great on the sample as it was, but when I changed it so that the first 4 questions had answers, and the 5th was blank, it still only pasted the missed students for the first two questions. I tried to figure out where to adapt it, but could not.

    Also, the code needs to skip any question that has 100% (or 1) in row 5. Or it at least needs to not get tripped up by them. I accomplished this inefficiently by adding another if statement before the code section for that column, but again, there has to be a better way.

    Attached is the actual file, minus some of the auxiliary sheets.
    Test View Template v081.xlsm

    So, it needs to
    1)Skip or not get stopped by questions where all students answered correctly (100% in row 59 (Questions #4 and #37 in the attached file)
    2)Stop when it hits the last question on the test, which is probably best determined by a blank cell in Row 10.

    General info:

    This is a template for all teachers to use. Test generally range anywhere from 15 to 60 questions. Everything from C8 to BY(x) is exported from the database that the tests are scanned to. Correct answers are marked with a +, but could otherwise be any value.

    If this is too much to ask on a public help forum, I understand, though I truly do appreciate the help.

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: repeating macro column by column until it hits a blank

    see if attached workbook is working for you.
    I hope I did not forget any of your requirements.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-21-2014
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: repeating macro column by column until it hits a blank

    Yes! That worked amazingly. And took over two minutes off of my inefficient coding. Thanks so much for sharing your time.

+ 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. [SOLVED] Macro to copy columns and paste into one column in next blank column
    By rmmohan in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-31-2013, 03:14 PM
  2. Search and highlight hits only in Column C
    By kenelder in forum Excel General
    Replies: 5
    Last Post: 06-12-2013, 11:44 AM
  3. Replies: 0
    Last Post: 06-11-2012, 10:28 AM
  4. Replies: 4
    Last Post: 05-10-2012, 08:16 PM
  5. macro to find first blank cell in a column cut the value from left adjacent column
    By willykin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-01-2012, 09:23 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