PDA

View Full Version : need help to edit code use values instead of coords



estatefinds
02-10-2023, 05:31 PM
The following code works with Coords for Example: 1-10- but would like to have used on values such as 5678 or 9872 etc.


Sub blah()
'USED WITH FOR EXAMPLE 2-2-A WILL BE PLACED AS 2-2- IN COLUMN AF THEN RUN THE BLAH
Set Destn = Range("AI2:AP71")
DVal = Destn.Value
Range("AF1").Value = "temp"
Set SceData = Range(Range("AF1"), Range("AF1").End(xlDown))
SceData.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("AE1"), Unique:=True
Set Uniques = Range(Range("AE2"), Range("AE1").End(xlDown))
For Each cll In Uniques.Cells
x = Application.CountIf(SceData, cll.Value)
coords = Split(cll.Value, "-")
DVal(CLng(coords(1)), CLng(coords(0))) = x
Next cll Range("AE1:AF1").ClearContents
Uniques.ClearContents
Destn.Value = DVal
End Sub

p45cal
02-11-2023, 11:20 AM
The name of the sub leads me to think it could be one of mine.
At first glance, I see no reason it shouldn't work with larger values.
Where did you get it?
Also, it would make things easier (and give context) if you could attach a workbook to work on.