Updating Items in Collection

I have been working with collections for sometime now, i had always either deleted or added item in the collection but never updated. Today i had a need to do that, when i searched i couldn’t find a direct method to get a item in a collection updated. After some confusing moments i ended up the following code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Dim t As New Collection
Dim iRemove As Integer
Dim iCnt As Integer
 
iRemove = 3
t.Add ("te")
t.Add ("ew")
t.Add ("Ad")
t.Add ("Adtree")
t.Add ("tewww")
MsgBox t(iRemove)
Call t.Add("Ads", , IIf(iRemove = t.Count, iRemove, iRemove + 1))
For iCnt = 1 To t.Count
Debug.Print t(iCnt)
Next
t.Remove (IIf(iRemove + 1 = t.Count, iRemove + 1, iRemove))
MsgBox t(iRemove)
 
For iCnt = 1 To t.Count
Debug.Print t(iCnt)
Next

Nothing too fancy in that code, so far it has worked fine but will wait till i implement it in the main code to celebrate 😉 :D. On another note, i have been reviewing UCertify’s PrepEngine, I must say it’s pretty darn good. Soon, in couple of days, you see a full review of their product in my blog.

Turning off gridlines in Excel Worksheet

I spent half of yesterday figuring out this. So i am posting it here so that it will be reminder for me and for other’s :). Here are the instructions…

  1. Select the worksheet.
  2. Goto Tools->Options->View tab – Windows Options section.
  3. Check or Uncheck Gridlines to show or hide them.