Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Evalulate previous cell

Hi all,

How can I Eval cell value before allowing the user to move to the next cell.
I.E.

In A1:A6 the user enters a 5-6 Digit reference code (Mixure of
Text&Number), if one of my reserved codes is used (I.E. A1234 or A5678 or
B9999) then a warning pop-up and not allow the user to move to the next cell
on the right.

Either some solution as a formula or VBA will be fine.

Thanks

Laddie.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Evalulate previous cell

I didn't test this but it should work. If not post back.

Private Sub Worksheet_Change(ByVal Target As Range)
resRng = Range("A1:A6")
If Target = Intersect(Target, resRng) Then
If Target.Value = A1234 Or Target.Value = A5678 _
Or Target.Value = B9999 Then
goBack = MsgBox("You cannot use a reserved number." _
,vbInformation, "TRY AGAIN")
Target.Value = ""
End If
End If
End Sub

"LaDdIe" wrote:

Hi all,

How can I Eval cell value before allowing the user to move to the next cell.
I.E.

In A1:A6 the user enters a 5-6 Digit reference code (Mixure of
Text&Number), if one of my reserved codes is used (I.E. A1234 or A5678 or
B9999) then a warning pop-up and not allow the user to move to the next cell
on the right.

Either some solution as a formula or VBA will be fine.

Thanks

Laddie.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Evalulate previous cell

Forgot to mention that the code goes in the sheet module.

"LaDdIe" wrote:

Hi all,

How can I Eval cell value before allowing the user to move to the next cell.
I.E.

In A1:A6 the user enters a 5-6 Digit reference code (Mixure of
Text&Number), if one of my reserved codes is used (I.E. A1234 or A5678 or
B9999) then a warning pop-up and not allow the user to move to the next cell
on the right.

Either some solution as a formula or VBA will be fine.

Thanks

Laddie.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Evalulate previous cell

1. Select the cell range A1:A6
2. Select DataValidationSettings tab
3. In the Allow box, select Custom
4. In the formula box paste this:
=NOT(OR(A1 = "B9999", A1 = "A1234", A1 = "A5678"))

Note that you can optionally add an Input Message and Error Alert. These
respectively display a popup window (tool tip) with a custom message when a
cell in the range is selected and a custom error message if/when one of your
reserved codes is entered.

Greg

"LaDdIe" wrote:

Hi all,

How can I Eval cell value before allowing the user to move to the next cell.
I.E.

In A1:A6 the user enters a 5-6 Digit reference code (Mixure of
Text&Number), if one of my reserved codes is used (I.E. A1234 or A5678 or
B9999) then a warning pop-up and not allow the user to move to the next cell
on the right.

Either some solution as a formula or VBA will be fine.

Thanks

Laddie.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Evalulate previous cell

Thanks for looking into it , but it did'nt work, any after thoughts?

"JLGWhiz" wrote:

I didn't test this but it should work. If not post back.

Private Sub Worksheet_Change(ByVal Target As Range)
resRng = Range("A1:A6")
If Target = Intersect(Target, resRng) Then
If Target.Value = A1234 Or Target.Value = A5678 _
Or Target.Value = B9999 Then
goBack = MsgBox("You cannot use a reserved number." _
,vbInformation, "TRY AGAIN")
Target.Value = ""
End If
End If
End Sub

"LaDdIe" wrote:

Hi all,

How can I Eval cell value before allowing the user to move to the next cell.
I.E.

In A1:A6 the user enters a 5-6 Digit reference code (Mixure of
Text&Number), if one of my reserved codes is used (I.E. A1234 or A5678 or
B9999) then a warning pop-up and not allow the user to move to the next cell
on the right.

Either some solution as a formula or VBA will be fine.

Thanks

Laddie.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Evalulate previous cell

Thanks Greg, but it did'nt work for me

"Greg Wilson" wrote:

1. Select the cell range A1:A6
2. Select DataValidationSettings tab
3. In the Allow box, select Custom
4. In the formula box paste this:
=NOT(OR(A1 = "B9999", A1 = "A1234", A1 = "A5678"))

Note that you can optionally add an Input Message and Error Alert. These
respectively display a popup window (tool tip) with a custom message when a
cell in the range is selected and a custom error message if/when one of your
reserved codes is entered.

Greg

"LaDdIe" wrote:

Hi all,

How can I Eval cell value before allowing the user to move to the next cell.
I.E.

In A1:A6 the user enters a 5-6 Digit reference code (Mixure of
Text&Number), if one of my reserved codes is used (I.E. A1234 or A5678 or
B9999) then a warning pop-up and not allow the user to move to the next cell
on the right.

Either some solution as a formula or VBA will be fine.

Thanks

Laddie.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Evalulate previous cell

Sorry Greg My fault in entering formula, It does work!
Thanks

"Greg Wilson" wrote:

1. Select the cell range A1:A6
2. Select DataValidationSettings tab
3. In the Allow box, select Custom
4. In the formula box paste this:
=NOT(OR(A1 = "B9999", A1 = "A1234", A1 = "A5678"))

Note that you can optionally add an Input Message and Error Alert. These
respectively display a popup window (tool tip) with a custom message when a
cell in the range is selected and a custom error message if/when one of your
reserved codes is entered.

Greg

"LaDdIe" wrote:

Hi all,

How can I Eval cell value before allowing the user to move to the next cell.
I.E.

In A1:A6 the user enters a 5-6 Digit reference code (Mixure of
Text&Number), if one of my reserved codes is used (I.E. A1234 or A5678 or
B9999) then a warning pop-up and not allow the user to move to the next cell
on the right.

Either some solution as a formula or VBA will be fine.

Thanks

Laddie.

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
3-Color Scale Vlookup for Current Month/Previous/Pre-Previous NeoFax Excel Discussion (Misc queries) 2 January 8th 10 07:04 PM
How can I copy a value from a cell and paste it into another cell while adding it to the previous value in that cell [email protected] Excel Worksheet Functions 2 November 7th 07 09:39 AM
auto populate cell based on previous cell drop down list selectio. PuzzledbyLists Excel Discussion (Misc queries) 2 September 11th 06 01:28 AM
conditional cell format based on cell in same row, previous column tamiluchi Excel Worksheet Functions 7 May 3rd 06 04:11 PM
Select cell, Copy it, Paste it, Return to Previous cell spydor Excel Discussion (Misc queries) 1 December 30th 05 01:29 PM


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