VBA Macro help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • preethib83
    New Member
    • May 2009
    • 1

    VBA Macro help

    Hi,

    I need help with respect to conditional check

    In Sheet1 worksheet
    check column "D" which has value "X" then check the respective value in column "A" is "Null" for entire column

    After full iteration i need print "none" sheet2

    Thanks,
    Preethi
  • KLynnM333
    New Member
    • Nov 2008
    • 3

    #2
    Try this, it will loop through your sheet until column D has no value:

    Code:
    'Sets the selected cell = D2, use 1 if you don't have a header row
    ActiveCell.Offset(2 - ActiveCell.Row, 4 - ActiveCell.Column).Select
    
    Do Until ActiveCell.Value = ""
    
    	If ActiveCell.Value = "X" Then
    	
    		ActiveCell.Offset(0, -3).Select
    
    		'Empty is Null in Excel VBA
    		If ActiveCell.Value = Empty Or ActiveCell.Value = "" Then
    
    			MsgBox "None!"
    
    		End If
    
    		ActiveCell.Offset(0, 3).Select
    
    	End If
    
    	ActiveCell.Offset(1, 0).Select
    
    Loop

    Comment

    Working...