Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default I need to expand my code for mandatory cell entry - Need help!!

I have inserted the following code into my workbook to force data entry in F3
in my worksheet - thanks to some wonderful help from members of this forum it
works perfectly!!

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set colf = Range("F3")
Set t = Target
If Intersect(t, colf) Is Nothing Then
If Checklit Then
If colf.Value = "" Then
Application.EnableEvents = False
colf.Select
Application.EnableEvents = True
Else
Checklit = False
End If
End If
Else
Checklit = True
End If
End Sub

However, I now need to be able to force data entry whenever the user clicks
on the following ranges: F3:f50, G3:g50, and I3:I50.

Can someone help me? I'm so frustrated........

Thanks - Cindyb

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 527
Default I need to expand my code for mandatory cell entry - Need help!!

Cindy, the easiest way is to create a range name for the ranges and call it
say InputRange. The Named range will look something like

=Sheet5!$F$3:$C$50,Sheet5!$g$3:$F$50,Sheet5!$I$3:$ I$50

then just change the code to

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set colf = Range("InputRange")

Should still work perfectly

Peter
"CindyB" wrote:

I have inserted the following code into my workbook to force data entry in F3
in my worksheet - thanks to some wonderful help from members of this forum it
works perfectly!!

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set colf = Range("F3")
Set t = Target
If Intersect(t, colf) Is Nothing Then
If Checklit Then
If colf.Value = "" Then
Application.EnableEvents = False
colf.Select
Application.EnableEvents = True
Else
Checklit = False
End If
End If
Else
Checklit = True
End If
End Sub

However, I now need to be able to force data entry whenever the user clicks
on the following ranges: F3:f50, G3:g50, and I3:I50.

Can someone help me? I'm so frustrated........

Thanks - Cindyb

Reply
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
mandatory cell [email protected] Excel Discussion (Misc queries) 1 January 16th 08 05:28 PM
Mandatory entry for a group of cells? JB Excel Discussion (Misc queries) 3 May 16th 07 07:51 PM
Mandatory cell Jeff Excel Discussion (Misc queries) 13 February 5th 07 04:02 PM
Cell to be mandatory fill in CBrausa Excel Discussion (Misc queries) 7 March 10th 06 02:09 PM
Making Cell Entry Mandatory Sue T Excel Discussion (Misc queries) 4 August 17th 05 03:45 PM


All times are GMT +1. The time now is 09:18 PM.

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

About Us

"It's about Microsoft Excel"