#1   Report Post  
Kevin
 
Posts: n/a
Default ranges and columns

hi
i have a worksheet that contains list of questions in rows
i then have three columns called OK, Not OK and N/A
the user must select one of these cells(in line with the question)
Whati want to do is
if the user selects Not ok and realises he/she has made a mistake, if
the user then selects ok or N/A it clears the contents of Not ok Cell
and put X in relevent cell.

can anyone help with this

thanks

kevin
  #2   Report Post  
Otto Moehrbach
 
Posts: n/a
Default

Kevin
The following two sheet macros do what you want. Right click the sheet
tab, select View code, and paste these macros into the displayed module.
HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target = "" Then Exit Sub
If Target.Column < 4 Or Target.Column 6 Then Exit Sub
If Target.Column = 4 Then
Application.EnableEvents = False
Target.Offset(, 1).Resize(, 2).ClearContents
Application.EnableEvents = True
End If
If Target.Column = 6 Then
Application.EnableEvents = False
Target.Offset(, -2).Resize(, 2).ClearContents
Application.EnableEvents = True
End If
If Target.Column = 5 Then
Application.EnableEvents = False
Target.Offset(, -1).ClearContents
Target.Offset(, 1).ClearContents
Application.EnableEvents = True
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column < 4 Or Target.Column 6 Then Exit Sub
Target = "X"
End Sub
"Kevin" wrote in message
om...
hi
i have a worksheet that contains list of questions in rows
i then have three columns called OK, Not OK and N/A
the user must select one of these cells(in line with the question)
Whati want to do is
if the user selects Not ok and realises he/she has made a mistake, if
the user then selects ok or N/A it clears the contents of Not ok Cell
and put X in relevent cell.

can anyone help with this

thanks

kevin



  #3   Report Post  
Kevin
 
Posts: n/a
Default

Thanks
works a treat

"Otto Moehrbach" wrote in message ...
Kevin
The following two sheet macros do what you want. Right click the sheet
tab, select View code, and paste these macros into the displayed module.
HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target = "" Then Exit Sub
If Target.Column < 4 Or Target.Column 6 Then Exit Sub
If Target.Column = 4 Then
Application.EnableEvents = False
Target.Offset(, 1).Resize(, 2).ClearContents
Application.EnableEvents = True
End If
If Target.Column = 6 Then
Application.EnableEvents = False
Target.Offset(, -2).Resize(, 2).ClearContents
Application.EnableEvents = True
End If
If Target.Column = 5 Then
Application.EnableEvents = False
Target.Offset(, -1).ClearContents
Target.Offset(, 1).ClearContents
Application.EnableEvents = True
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column < 4 Or Target.Column 6 Then Exit Sub
Target = "X"
End Sub
"Kevin" wrote in message
om...
hi
i have a worksheet that contains list of questions in rows
i then have three columns called OK, Not OK and N/A
the user must select one of these cells(in line with the question)
Whati want to do is
if the user selects Not ok and realises he/she has made a mistake, if
the user then selects ok or N/A it clears the contents of Not ok Cell
and put X in relevent cell.

can anyone help with this

thanks

kevin

  #4   Report Post  
Kevin
 
Posts: n/a
Default

I have a query regarding the code
If i select a merged cell the sheet code crashes
the only way i can make the code active again is to close the workbook
and reopen it.
Can this code be adapted to deal with merged cells and is it posible
to restrict the number of rows

thanks
kevin
(Kevin) wrote in message . com...
Thanks
works a treat

"Otto Moehrbach" wrote in message ...
Kevin
The following two sheet macros do what you want. Right click the sheet
tab, select View code, and paste these macros into the displayed module.
HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target = "" Then Exit Sub
If Target.Column < 4 Or Target.Column 6 Then Exit Sub
If Target.Column = 4 Then
Application.EnableEvents = False
Target.Offset(, 1).Resize(, 2).ClearContents
Application.EnableEvents = True
End If
If Target.Column = 6 Then
Application.EnableEvents = False
Target.Offset(, -2).Resize(, 2).ClearContents
Application.EnableEvents = True
End If
If Target.Column = 5 Then
Application.EnableEvents = False
Target.Offset(, -1).ClearContents
Target.Offset(, 1).ClearContents
Application.EnableEvents = True
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column < 4 Or Target.Column 6 Then Exit Sub
Target = "X"
End Sub
"Kevin" wrote in message
om...
hi
i have a worksheet that contains list of questions in rows
i then have three columns called OK, Not OK and N/A
the user must select one of these cells(in line with the question)
Whati want to do is
if the user selects Not ok and realises he/she has made a mistake, if
the user then selects ok or N/A it clears the contents of Not ok Cell
and put X in relevent cell.

can anyone help with this

thanks

kevin

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
Why can't a copy and paste columns? Nicole L. Excel Worksheet Functions 3 February 10th 05 06:55 PM
Conditional Formula to search ranges?? adean Excel Discussion (Misc queries) 2 December 13th 04 10:53 PM
Problem with graph ranges No Such Luck Charts and Charting in Excel 6 December 3rd 04 01:09 PM
Ranges with in a LOOKUP Elijah Excel Worksheet Functions 2 November 23rd 04 10:40 AM
SUMIF and 3-D Ranges Ron In Tulsa Excel Worksheet Functions 2 November 22nd 04 07:30 PM


All times are GMT +1. The time now is 05:47 AM.

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"