ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command button code(SC) (https://www.excelbanter.com/excel-programming/391045-command-button-code-sc.html)

Ram[_5_]

Command button code(SC)
 
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


Norman Jones

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




FSt1

Command button code(SC)
 
hi,
there is alot of freeware to crack passwords. excel security is not that good.
http://www.cpearson.com/excel/password.htm
http://www.mcgimpsey.com/excel/fileandvbapwords.html
http://www.nirsoft.net/utils/accesspv.html

go a google. you'll find more.

Regards
FSt1
"Ram" wrote:

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



FSt1

Command button code(SC)
 
opps. wrong thread
sorry
FSt1

"FSt1" wrote:

hi,
there is alot of freeware to crack passwords. excel security is not that good.
http://www.cpearson.com/excel/password.htm
http://www.mcgimpsey.com/excel/fileandvbapwords.html
http://www.nirsoft.net/utils/accesspv.html

go a google. you'll find more.

Regards
FSt1
"Ram" wrote:

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



Ram[_5_]

Command button code(SC)
 
On Jun 10, 5:29 pm, FSt1 wrote:
opps. wrong thread
sorry
FSt1



"FSt1" wrote:
hi,
there is alot of freeware to crack passwords. excel security is not that good.
http://www.cpearson.com/excel/password.htm
http://www.mcgimpsey.com/excel/fileandvbapwords.html
http://www.nirsoft.net/utils/accesspv.html


go a google. you'll find more.


Regards
FSt1
"Ram" wrote:


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- Hide quoted text -


- Show quoted text -


Thanks a lot this works.. But instead of cell numbers I want to
declare specific names to be displayed in the message box as this code
returns a msg box that says "All of the cells H13, H14, H15, H16
should be completed". Is it Possible.


Ram[_5_]

Command button code(SC)
 
On Jun 11, 11:05 am, Ram wrote:
On Jun 10, 5:29 pm, FSt1 wrote:





opps. wrong thread
sorry
FSt1


"FSt1" wrote:
hi,
there is alot of freeware to crack passwords. excel security is not that good.
http://www.cpearson.com/excel/password.htm
http://www.mcgimpsey.com/excel/fileandvbapwords.html
http://www.nirsoft.net/utils/accesspv.html


go a google. you'll find more.


Regards
FSt1
"Ram" wrote:


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- Hide quoted text -


- Show quoted text -


Thanks a lot this works.. But instead of cell numbers I want to
declare specific names to be displayed in the message box as this code
returns a msg box that says "All of the cells H13, H14, H15, H16
should be completed". Is it Possible.- Hide quoted text -

- Show quoted text -


I have fixed the issue of getting names instead of cell address.



All times are GMT +1. The time now is 02:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com