I tried this code to show message only if I select any row in a sheets else exit sub but didn't work
[VBA]Dim wsh As Worksheet
If Not wsh.Rows.Select Then Exit Sub
MsgBox ("ok")[/VBA]
I tried this code to show message only if I select any row in a sheets else exit sub but didn't work
[VBA]Dim wsh As Worksheet
If Not wsh.Rows.Select Then Exit Sub
MsgBox ("ok")[/VBA]
Put this in the ThisWorkbook module
[vba]Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Dim Rws
Rws = Target.Cells.Count / Sh.Columns.Count
If Rws - Int(Rws) = 0 Then MsgBox Rws & " rows selected"
End Sub
[/vba]
Last edited by mdmackillop; 02-14-2011 at 02:33 AM. Reason: Minor correction
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
thank you for help!!
thank you for help!