LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default A better way to do this?

Hi All,

Is there a more efficient / better way of doing this?

The code below is used in a user form where the user selects a single
cell using the RefEdit control. It ensures the user only selects a
single cell, within a specified range, and a selection is actually
made. The form is not to be unloaded until the correct conditions
exist.

All help gratefully received.

Private Sub cmdEnter_Click()
Dim Cella As Range
If rngCell.Value = "" Then
MsgBox ("You must select a single cell in the range H5:I11")
Exit Sub
Else
Set Cella = Range(rngCell.Value)
End If
If Cella.Cells.Count 1 Or Cella Is Nothing Then
MsgBox ("You must select a single cell in the range H5:I11")
Exit Sub
End If
If Intersect(Cella, ActiveSheet.Range("H5:I11")) Is Nothing Then
MsgBox ("You must select a single cell in the range H5:I11")
Exit Sub
Else
Cella.Select
Unload frmCell
End If

End Sub

Regards

Mike Beckinsale

 
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



All times are GMT +1. The time now is 12:10 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"