Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Pat
 
Posts: n/a
Default Warn if data is in range

I need a warning to appear when a user enter a value into A1, if there is a
value in any cell in the range B1:T1

Any one got a solution?
Thanks
Pat


  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Hi Pat,

One way

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$A$1" Then
If Application.CountA(Range("B1:T1")) 0 Then
MsgBox "Data in B1:T1"
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Pat" wrote in message
...
I need a warning to appear when a user enter a value into A1, if there is

a
value in any cell in the range B1:T1

Any one got a solution?
Thanks
Pat




  #3   Report Post  
Ola
 
Posts: n/a
Default

Try this:
Goto cell A1. Select menu: Data Validation...
Tab: Settings Allow: Custom Formula: =COUNT(B1:T1)=0
Tab: Error Alert Title: Error Values present in B1:T1

Done!

Ola Sandstrom

  #4   Report Post  
JulieD
 
Posts: n/a
Default

Hi Pat

you can code a worksheet_change even to check to see if there is anything in
B1:T1 when data is entered in A1 - e.g.

----
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value < "" Then
If
Application.WorksheetFunction.CountIf(Sheets("Shee t3").Range("B1:T1"), "*")
= 1 Then

MsgBox "Range B1:T1 is not empty"
End If
End If
End Sub
---

to use the code, right mouse click on the sheet that you want to run the
code against and choose view code
copy & paste the above directly into the right hand side screen - if you get
any red lines, click at the end of the line and press the delete key - this
should fix up any line break problems.
change "Sheet3" to the name of your sheet
use alt & f11 to switch back to your worksheet and test

Hope this helps
Cheers
JulieD

"Pat" wrote in message
...
I need a warning to appear when a user enter a value into A1, if there is a
value in any cell in the range B1:T1

Any one got a solution?
Thanks
Pat




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
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
How can I check if data in an external data range is changed afte. Ruud Excel Worksheet Functions 0 January 7th 05 12:15 PM
How can I check if data in external data range is changed after re Ruud Excel Discussion (Misc queries) 0 January 7th 05 12:07 PM
how do I make a formula NOT change when the data range is moved? Alida Andrews Excel Discussion (Misc queries) 2 January 6th 05 09:02 PM
Can you average data in 1 column based on a range of values in another? kman24 Excel Worksheet Functions 2 November 17th 04 02:09 PM


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