Can you advise what is happening here please

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Morning,
I have a worksheet where in column A there are customers names.
There are no dupliacted names as when a repeat buyer is entered its then 002 003 etc etc
The names are like example.
Tom Jones
Tom Jones 001
Bob Sty 001
Charlie 001
Etc Etc

Recently something didnt work correctly as when i now start to type Tom Jones i see it change to Tom Jones 001 001 and at this point i havent left the cell yet if that helps.
I decided to remove the code so looking on the worksheet code i found & deleted the below.
I assume that was the correct code by looking at it ?

BUT
After saving,closing then opening the worksheet excel still wants to do something on its own.

Another example.
There is a customer called ALEX HOBBS 001 so a new row and in cell A6 i start to type ALEX H and now at this point i see the rest of the name entered like so OBBS 001 so when i leave the cell i see ALEX HOBBS 001 "so now there is a duplicate"

After deleting that code Ive looked on the worksheet and see nothing that mentions 001 or referene to A6 so i now think all the related code is gone.
I have also looked in THIS WORKBOOK etc but also nothing there that relates to it.

Why is excel doing this as it thinks i want to actually type ALEX HOBBS 001 again and is tying to be helpfull ?

If this helps if i type a name that isnt in column A the above doesnt happen, it seems to only do it if the name is allready in column A



VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim Changed As Range, c As Range, DataRange As Range

  Set Changed = Intersect(Target, Columns("A"))
  If Not Changed Is Nothing Then
    Set DataRange = Range("A2", Range("A" & Rows.Count).End(xlUp))
    Application.EnableEvents = False
    For Each c In Changed
      If Len(c.Value) > 0 Then
          c.Value = c.Value & Format(Evaluate("countif(" & DataRange.Address & ",""" & c.Value & " 0*"")") + 1, " 000")
      End If
    Next c
    Application.EnableEvents = True
  End If
  If Not Intersect(Target, Range("A5:W5")) Is Nothing Then
    Application.EnableEvents = False
    Range("A5:W5").Value = UCase(Range("A5:W5").Value)
    Application.EnableEvents = True
End If
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
That sounds like the 'Enable autocomplete for cell values' setting in the Advanced section of Excel Options.
 
Upvote 0
Hi,
Now that you pointed me in the right place you are correct thansk.
 
Upvote 0

Forum statistics

Threads
1,214,785
Messages
6,121,543
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top