LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
command button code dummy Excel Discussion (Misc queries) 2 December 1st 09 02:57 PM
Command button code Gary[_22_] Excel Programming 6 May 16th 07 02:33 PM
Command button code packwolf94 Excel Programming 3 April 26th 07 07:54 AM
Command button code taps54 Excel Programming 3 September 21st 06 01:16 PM
Command Button VBA code Dave Peterson Excel Discussion (Misc queries) 2 January 25th 05 11:28 PM


All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"