View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Wouter HM Wouter HM is offline
external usenet poster
 
Posts: 99
Default If statement in macro to find blank cell/value in another cell

On 9 mrt, 16:14, Kennedy wrote:
Trying to find a macro that will allow me to find a blank cell in a column,
and if the corresponding cell is populated, then tag that cell with a certain
value.
So, if Column AG is empty, but Column AM is not, then put an * in column AG,
then loop it to look in other columns as well.
So
if AG = blank, but AM is not blank, then place * in AG,
if AN = blank, but AT is not blank, then place * in AN,
if AU = blank, but BA is not blank, then place * in AU,
if BB = blank, but BH is not blank, then place * in BB,
etc.... For a total of 15 segments


Hi Kennedy,

I tried this and looks to work fine on the current row only.

Sub SegmentMarker()

Dim iL As Integer
Dim iC1 As Integer
Dim iC2 As Integer
Dim iR As Integer

iR = ActiveCell.Row
iC1 = 33
iC2 = 39
For iL = 1 To 15
If IsEmpty(Cells(iR, iC1)) Then
If Not IsEmpty(Cells(iR, iC2)) Then
Cells(iR, iC1) = "'*"
End If
End If
iC1 = iC1 + 7
iC2 = iC2 + 7
Next
End Sub


HTH,

Wouter