View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Command button code(SC)

Hi Ram,

Try something like:

'=============
Private Sub CommandButton1_Click()
Dim Rng As Range
Dim Rng2 As Range

Set Rng = Me.Range("R_nm,Eml,Date,Cntry") '<<=== CHANGE

On Error Resume Next
Set Rng2 = Rng.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If Not Rng2 Is Nothing Then
MsgBox Prompt:="All of the cells " _
& Rng.Address(False, False) _
& " should be completed.", _
Buttons:=vbInformation, _
Title:="Missing Data"
Rng2.Cells(1).Select
Exit Sub
End If

Me.Next.Select

End Sub
'<<=============



---
Regards,
Norman


"Ram" wrote in message
oups.com...
Hi,

I have 4 madatory cells in my Excel sheet, and I have to design it in
such a way that if and only if these 4 cells are filled and on
clicking next button it should take us to the next page"Worksheet
name : nxt_pg". If any on the cell is Blank a msg box should appear
asking to Provide Details and on clicking OK it should activate the
cell that is left blank. All the 4 cells are named (R_nm, E-ml, Date,
Cntry).

Thanks for your help in advance

SC