Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-14-2011, 04:58 AM
Hwyn Hwyn is offline Vba, Is there a better way to test empty cells? Windows Vista Vba, Is there a better way to test empty cells? Office 2007
Novice
Vba, Is there a better way to test empty cells?
 
Join Date: Nov 2011
Location: Cardiff
Posts: 5
Hwyn is on a distinguished road
Default Vba, Is there a better way to test empty cells?

Hello everyone, I have some working Excel 2007 code, but i was wondering if there is a shorter way of testing consecutive cells in a row to see if they are empty rather than testing each cell individually, typically columns "J" to "Q" .This is my first post, apologies if i haven't structured my question properly.

Sub


Dim rng As Range, cell As Range
LastRow = Cells(Rows.Count, "a").End(xlUp).Row
Set rng = Range("a2:a" & LastRow)
For Each cell In rng
If cell.Value Like "*FUJ*" And _
IsEmpty(Cells(cell.Row, "j")) And IsEmpty(Cells(cell.Row, "k")) And _
IsEmpty(Cells(cell.Row, "l")) And IsEmpty(Cells(cell.Row, "m")) And _
IsEmpty(Cells(cell.Row, "n")) And IsEmpty(Cells(cell.Row, "o")) And _
IsEmpty(Cells(cell.Row, "p")) And IsEmpty(Cells(cell.Row, "q")) = True Then
Cells(cell.Row, "u").Value = "Out of Stock"
Else
Cells(cell.Row, "u").Value = "In Stock"
End If
Next
End Sub

Regards Robert
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vba, Is there a better way to test empty cells? Empty rules rene.kamphuis@ciz.nl Mail Merge 21 04-15-2011 12:34 AM
Open source DDE test methods? d.rock90 Excel Programming 1 01-05-2011 12:03 PM
Test after presentation? barnkat PowerPoint 0 08-13-2010 10:58 AM
Count range cells eliminating merge cells danbenedek Excel 0 06-15-2010 12:40 AM
how to add test in word document tekle Word 2 05-24-2010 01:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft