+ Reply to Thread
Results 1 to 9 of 9

How to write loop to check for empty cells

  1. #1
    Registered User
    Join Date
    07-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Question How to write loop to check for empty cells

    Hello all,

    I'm new to VBA and was wondering how would I go about to write a loop to check for empty cells? For example, I have a column named Cycle Time and every file has a different number of cycles. I want to apply a simple formula [###/(3600/16)] if and only if there is a corresponding value in the cycle time column. example.jpg Any help would be appreciated!

    Thanks,

    J

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to write loop to check for empty cells

    What would you like to do if an empty cell is found?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    07-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: How to write loop to check for empty cells

    Sorry, forgot to mention that if an empty cell is found, it is finished and doesn't do anything else.

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to write loop to check for empty cells

    Oh I think I understand. You would like to copy the formula in every cell in column Y that has data in column X?

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to write loop to check for empty cells

    Try:
    Please Login or Register  to view this content.
    You'll have the change A to the column you want to check for a value and B to the column you'd like to place the formula. Also the formula you'd like to enter can be any formula. Just change the formula between the "" to the formula you'd like.

  6. #6
    Registered User
    Join Date
    07-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: How to write loop to check for empty cells

    Yes, that's pretty much what I'm looking for. For the formula part, if I want to have it to take the value of A, would it be something like
    Range("B" & l).Formula = "=A/(3600/16)"?

    Thank you so much for the help so far.

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655
    The value of A the column? A specific row in that column?

  8. #8
    Registered User
    Join Date
    07-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: How to write loop to check for empty cells

    Nevermind, I got it. Thank you so much for the help!
    Last edited by JaydenK; 07-22-2013 at 09:06 AM.

  9. #9
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to write loop to check for empty cells

    I'm glad you got it figured out. If you are happy with the solution please mark the thread as [SOLVED].

+ 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] Check for empty cells on exit
    By Noneil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2013, 08:12 AM
  2. Need Help to write Macro which should check coloumn cells should not contain '-app'
    By rishabh2012 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-01-2013, 07:46 AM
  3. check for non-empty cells outside of a certain range
    By Abe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-28-2006, 01:50 PM
  4. check for non-empty cells outside of a certain range
    By Abe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-28-2006, 11:45 AM
  5. [SOLVED] Empty cells in For Loop
    By Linking to specific cells in pivot table in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2005, 03:06 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