Thread: VBA Program
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default VBA Program

To answer your question, it could have been as simple as the other user
typing lower case c instead of C. But, if your goal is to move col N to col
O WHEN c or C is entered in col C then this may be more efficient. Why did
you have a for each loop for ONE selection?

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C12:C500")) Is Nothing Then Exit Sub
Application.EnableEvents = False
If UCase(Target) = "C" And Target.Offset(, 11) < "" Then
Target.Offset(, 11).Cut Destination:=Target.Offset(, 12)
End If
Application.EnableEvents = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rudy" wrote in message
...
Hi,

This is the sheet module


Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo endit
If Intersect(Target, Range("C12:C500")) Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each Cell In Target
If Target.Value = "C" And Target.Offset(0, 11) _
.Value < "" Then
With Target
.Offset(0, 12).Value = Target.Offset(0, 11).Value
.Offset(0, 11).ClearContents
End With
End If
Next
endit:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_BeforeRightClick _
(ByVal Target As Excel.Range, Cancel As Boolean)
If IsNumeric(Target) And Not IsEmpty(Target) Then
Application.Dialogs(xlDialogFormatNumber).Show
Cancel = True
End If
End Sub


"Jim Cone" wrote:

The code you posted is incomplete.
Please try again.
Also, what module contains the code - the sheet module or a standard
module?
--
Jim Cone
Portland, Oregon USA



"Rudy"
wrote in message
Hi,
There is this VBA program in my excel sheet that tells excel to :
Function MATHEMATICS()
IF C14="C"
N14 TO M14
End Function

If I am the one opening up this spreadsheet & type in the letter "C" on
column C14, the value in column "N14" automatically transposes on column
"O14". However, if someone else has opened this spreadsheet & type in "C"
on
column C14, the value in N14 does not automatically transposes on column
"O14". Pls help as I am going to handover this job to another person but
if
this problem cannot be resolved, he has to do the old fashion way.
Thanks...