sassa198614
New Member
- Joined
- Jun 6, 2018
- Messages
- 1
Good morning,
I'm an Italian guy who uses excel for small jobs in the office, the problem that I can not solve is this:
The file consists of a series of data in a column and I need the macro to do a count of the number of times a word appears in the column, then the macro in two other columns inserts me:
- in the first column the word found,
- in the column next to the number of times the word is present in the main column "names", as indicated in sheet1.
My problem is where in the main column "names" there are empty boxes, I would like to eliminate the count of empty boxes that the macro indicates to me with ZERO and also insert all the full boxes of the column.
the code:
Sub foglio1contarevalori()
Sheets("Foglio1").Activate
Range("a1").Select
Set rngData = Sheets("Foglio1").Range("a1", Sheets("Foglio1").Range("a1").End(xlDown))
rngData.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Cells(1, 3), Unique:=True
Set rngUniqueData = Range("c1", Range("c1").End(xlDown))
With rngUniqueData
For lngRow = 2 To .Rows.Count
lngCount = Application.WorksheetFunction.CountIf(rngData, .Cells(lngRow, 1).Value)
.Cells(lngRow, 1).Offset(0, 1).Value = lngCount
Next
End With
End Sub
I thank you for your attention and I hope for some help
I'm an Italian guy who uses excel for small jobs in the office, the problem that I can not solve is this:
The file consists of a series of data in a column and I need the macro to do a count of the number of times a word appears in the column, then the macro in two other columns inserts me:
- in the first column the word found,
- in the column next to the number of times the word is present in the main column "names", as indicated in sheet1.
My problem is where in the main column "names" there are empty boxes, I would like to eliminate the count of empty boxes that the macro indicates to me with ZERO and also insert all the full boxes of the column.
the code:
Sub foglio1contarevalori()
Sheets("Foglio1").Activate
Range("a1").Select
Set rngData = Sheets("Foglio1").Range("a1", Sheets("Foglio1").Range("a1").End(xlDown))
rngData.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Cells(1, 3), Unique:=True
Set rngUniqueData = Range("c1", Range("c1").End(xlDown))
With rngUniqueData
For lngRow = 2 To .Rows.Count
lngCount = Application.WorksheetFunction.CountIf(rngData, .Cells(lngRow, 1).Value)
.Cells(lngRow, 1).Offset(0, 1).Value = lngCount
Next
End With
End Sub
I thank you for your attention and I hope for some help