jotting down the blank row number

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
707
Office Version
  1. 365
  2. 2010
sor right now i have a loop that shows a message box saying if there is a number in column K, but column Q is blank, it'll display the blank row number for the analyst to fill in the blank in column Q with the necessary info.

however, rather than having the analyst jot down the row number, i want the macro to put the row number in column AA and of course build on the list if there is more than one row where the condition is true (i.e., number is column K, but column Q is blank)
 
Note that I had a typo and went back and edited my code, as I had "finalrow" where I should have had "c".

Note that by definition:
VBA Code:
Range("q" & c).Row
is exactly the same as
VBA Code:
c
(and HAS to be, by definition).
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Here is one way:
VBA Code:
    For c = 9 To finalrow
        If Range("O" & c).DisplayFormat.Interior.Color = 65535 And Range("Q" & c) = "" And Application.WorksheetFunction.IsNumber(Range("O" & c)) Then
            MsgBox "There is a blank contact column on row " & c
            r = r + 1
            Range("AA" & r).Value = c
        End If
    Next c

Note that "Range("q" & c).Row" can simply be replaced with "c".
No need to take the scenic round-about route back to where you started from!

thanks, it works, but is there is a way so that it starts from cell AA2? right now it's starting from AA1
 
Upvote 0
Sorry, I thought you wanted it to start in cell AA1.

Try this:
VBA Code:
    For c = 9 To finalrow
        If Range("O" & c).DisplayFormat.Interior.Color = 65535 And Range("Q" & c) = "" And Application.WorksheetFunction.IsNumber(Range("o" & c)) Then
            MsgBox "There is a blank contact column on row " & c
            Cells(Rows.Count, "AA").End(xlUp).Offset(1, 0).Value = c
        End If
    Next c
 
Upvote 0
Solution
Why not just start r as 1+1 as I suggested wrt i?
 
Upvote 0
Sorry, I thought you wanted it to start in cell AA1.

Try this:
VBA Code:
    For c = 9 To finalrow
        If Range("O" & c).DisplayFormat.Interior.Color = 65535 And Range("Q" & c) = "" And Application.WorksheetFunction.IsNumber(Range("o" & c)) Then
            MsgBox "There is a blank contact column on row " & c
            Cells(Rows.Count, "AA").End(xlUp).Offset(1, 0).Value = c
        End If
    Next c

perfect, ty!
 
Upvote 0
You are welcome.
Glad we were able to help!
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,037
Members
449,062
Latest member
mike575

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top