If statement in macro to find blank cell/value in another cell

K

Kennedy

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
 
W

Wouter HM

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top