Thread: Lookup VBA
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Lookup VBA

First off, you say you want to check the cell to the **right** of Column K (for being blank), but then you identify that column as Column I... Column I is two columns to the **left** of Column K, not one cell to the right. I'm guessing you meant to type Column L and mistakenly typed I instead. The following macro assumes you meant Column L.

Okay, here is a macro that should do what you want without employing any loops...

Sub CheckColKandL()
Dim K As Range, L As Range
On Error Resume Next
Set K = Range("K4:K" & Rows.Count).SpecialCells(xlCellTypeConstants).Enti reRow
Set L = Range("L4:L" & Rows.Count).SpecialCells(xlCellTypeBlanks).EntireR ow
If Not K Is Nothing And Not L Is Nothing Then
If Not Application.Intersect(K, L) Is Nothing Then MsgBox "Please update the sheet"
End If
End Sub

--
Rick (MVP - Excel)


"tomjoe" wrote in message ...
I have a workbook with 2 sheets.
I am looking for a short procedure that detects if there, in sheet 2, is any
occupied cell in column K (K4 and down) with no data in the cell to the right
(column I). Then a message should pop up saying: "Please update the sheet".

Any suggestions?