monoj chakraborty
Member
I am using the following code :
but I am not able to write the code which will do the following :
1. Select items with value more than 1
2. For those items, get the values for the keys
3. For those keys, find the cell address
4. merge the rows whereby the number of rows to merge is supplied by the corresponding item value
the file and macro attached
Mod Edit: Code tags added
Code:
Sub countThings()
Dim ws As Worksheet
Dim countries As Object
Application.ScreenUpdating = False
Set ws = Sheets("gsv")
Set countries = CreateObject("Scripting.Dictionary")
For x = 6 To 75
If Not countries.exists(ws.Range("A" & x).Value) Then
countries.Add ws.Range("A" & x).Value, 1
Else
countries(ws.Range("A" & x).Value) = countries(ws.Range("A" & x).Value) + 1
End If
Next x
' programme segment to select the rows to merge
' coding first to identify the first position of name of the country
' first step will be to identify items which have got value >1
Dim scroll As Integer
For scroll = 0 To countries.Count - 1
Debug.Print countries.items()(scroll), _
countries.keys()(scroll)
Next scroll
End Sub
but I am not able to write the code which will do the following :
1. Select items with value more than 1
2. For those items, get the values for the keys
3. For those keys, find the cell address
4. merge the rows whereby the number of rows to merge is supplied by the corresponding item value
the file and macro attached
Mod Edit: Code tags added
Attachments
Last edited by a moderator: