View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
leonardo leonardo is offline
external usenet poster
 
Posts: 9
Default cells mandatory to fill

thanks! it worked, one question how do I do so it does the same on three
different worksheets. My worksheets are named as follows: X340, X342n and
X642e?

"Tom Ogilvy" wrote:

Dim cell As Range
For Each cell In Sheets("X340").Range("T4:T53")
If len(trim(cell.Text)) = 0 Then
MsgBox "There is data missing" & cell.Address
Application.Goto cell
Cancel = True
Exit For
End If
Next cell


--
Regards,
Tom Ogilvy

"leonardo" wrote in message
...
this is the code I am currently using:

Dim cell As Range
For Each cell In

Sheets("X340").Range("T4,T5,T6,T7,T8,T9,T10,T11,T1 2,T13,T14,T15,T16,T17,T18,
T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T3 1,T32,T33,T34,T35,T36,T37,
T38,T39,T40,T41,T42,T43,T44,T45,T46,T47,T48,T49,T5 0,T51,T52,T53")
If IsEmpty(cell.Text) Then
MsgBox "There is data missing" & cell.Address
Application.Goto cell
Cancel = True
Exit For
End If
Next cell

hope this helps!

"Tom Ogilvy" wrote:

If a cell has anything in it including a formula or a null string, it

isn't
empty.

--
Regards,
Tom Ogilvy

"leonardo" wrote in message
...
I am creating a file in where if a user fills one column, other three
columns
should be filled also. Now, I have created a formula in where it

checks
that
all colums are filled; therefore, if one column has been filled and

others
are missing it will tell me that 'some info missing'.
Then, I inserted a function "if" that will leave a cell in blank for

that
row (=IF(S4="ok";"go ";" "), and I am trying to use the VBA

instruction to
not let the user save this file without making the neccesary

corrections,
but
the VBA instruction seems not to recognize the " " marks as an empty

cell,
what can I do?
thanks!