"channel", "facebook", "instagram" and "twitter" are "Object" data types
"i", "j" and "k" are "integer" data types
"ws" is "Woksheet" data type
Set channel = CreateObject("Scripting.Dictionary")
With channel
.Add "facebook", facebook
.Add "instagram", instagram
.Add "twitter", twitter
End With
Set facebook = CreateObject("Scripting.Dictionary")
With facebook
.Add "brand", 0
.Add "post", 0
.Add "likes", 0
.Add "comments", 0
.Add "boosted", 0
.Add "shares", 0
End With
Set instagram = CreateObject("Scripting.Dictionary")
With instagram
.Add "brand", 0
.Add "post", 0
.Add "likes", 0
.Add "comments", 0
End With
Set twitter = CreateObject("Scripting.Dictionary")
With twitter
.Add "brand", 0
.Add "post", 0
.Add "likes", 0
.Add "retweets", 0
.Add "is retweet", 0
End With
For Each ws In Sheets
For i = 0 To channel.count - 1
If channel.Keys()(i) = ws.name Then
Sheets(ws.name).Activate
emptyCol = WorksheetFunction.CountA(Range("1:1"))
emptyRow = WorksheetFunction.CountA(Range("A:A"))
For j = 1 To emptyCol
For k = 0 To channel(channel.Keys()(i)).count - 1
If InStr(Cells(1, j), channel(channel.Keys()(i)).Keys()(k)) <> 0 Then
channel(channel.Keys()(i))(channel(channel.Keys()(i))) = j
MsgBox channel(channel.Keys()(i)) & "." & channel(channel.Keys()(i)) & "=" & j
End If
Next k
Next j
End If
Next i
Next ws
The error which is coming up is:
It is highlighting the following code: For k = 0 To channel(channel.Keys()(i)).count - 1