+ Reply to Thread
Results 1 to 4 of 4

Make macro exception if data in field

  1. #1
    Registered User
    Join Date
    10-01-2007
    Posts
    9

    Make macro exception if data in field

    I have a macro that runs on all workbooks in a given directory. I want to check Column "AB" for any data, below the header in AB1. If there is any data in this column, I want the macro to skip this file, maybe record the name of the excepted file into a .txt, and go on to the next. Any suggestions?
    Last edited by Mechroneal; 10-10-2007 at 04:27 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    I have a macro that runs on all worksheets in a given directory. I want to check Column "AB" for any data, below the header in AB1. If there is any data in this column, I want the macro to skip this file, maybe record the name of the excepted file into a .txtand go on to the next. Any suggestions?
    I believe you mean: "workbooks"?

    In which worksheet(s)? The first worksheet in every workbook? All worksheets in every workbook? Some worksheets in every workbook?

  3. #3
    Registered User
    Join Date
    10-01-2007
    Posts
    9
    Quote Originally Posted by Ikaabod
    I believe you mean: "workbooks"?

    In which worksheet(s)? The first worksheet in every workbook? All worksheets in every workbook? Some worksheets in every workbook?
    D'oh! Good call. I did mean workbooks, each book only has one sheet.

  4. #4
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    Using code I found: HERE (be sure to read the bit about "Microsoft Scripting Runtime" at this link)
    I modified that code. I created another macro that attaches "zzzzzz" to the front of the filename of all files with no data in Column AB (excluding Cell AB1).
    Example: test1.xls (with no data) would turn into zzzzzztest1.xls
    If a file was converted to zzzzzztest1.xls but later has data in Column AB then the code will take the zzzzzz out of the filename. An error occurs if you already have another test1.xls saved.

    The first two subs I modified from the above link and should work well. The final "Sub" I made quick just to show you one way you might go about accomplishing the task.
    Please Login or Register  to view this content.
    Hopefully that at least puts you on the right track.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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