LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Limit data entre!

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit
Application.EnableEvents = False

With Target
If .Column = 3 Or .Column = 6 Then
If .Row 6 Then
.Value = ""
.Offset(6 - .Row, 0).Select
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "C:C,F:F" '<== change to suit

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Column = 3 Then
If .Offset(0, 3).Value < "" Then .Offset(0, 3).Select
Else
If .Offset(0, -3).Value < "" Then .Offset(0, -3).Select
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Scott_goddard" wrote in message
...
Bob,

Thanks i like this verision. Now i would like to protect some of the
sheet,
and only allow them to enter data in some of the cells. Ihave tried
several
ways but its not work, does your macro stop it.

I would like them only to be able to enter data int colum C, F and rows
1 - 6

"Bob Phillips" wrote:

One way


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "C:C,F:F" '<== change to suit

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Column = 3 Then
If .Offset(0, 3).Value < "" Then .Offset(0, 3).Select
Else
If .Offset(0, -3).Value < "" Then .Offset(0, -3).Select
End If
End With
End If

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

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Scott_goddard" wrote in message
...
Right i have two colums of data C and F. All i want to do is limit
data
to
only one of the colums. For example if someone types £3.00 in C19,
then F
19
would be blocked.






 
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
Excel Data Markers, Limit Qty Jeko Charts and Charting in Excel 3 December 1st 06 03:43 AM
find cell that contains text and delete entre row Cristi R Excel Discussion (Misc queries) 3 August 2nd 06 04:32 PM
out of limit data cjmiller Excel Discussion (Misc queries) 1 May 24th 06 06:50 PM
can you entre a bar code into a excel cell? basinghughes Excel Worksheet Functions 2 September 9th 05 06:32 PM
Nested IF limit or Open parentheses limit Fred Excel Discussion (Misc queries) 5 December 23rd 04 03:34 PM


All times are GMT +1. The time now is 08:56 AM.

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"