array values not matching

S

Steve

I am trying to use an array to change a column number, based on the
array values. However, the variable (colnum) remains starts at 0, then
1, etc. instead of 2,6,8,10,12:

Dim c As Range
Dim colnumarr As Variant
Dim colnum As Integer


colnumarr = Array(2, 6, 8, 10, 12)

For colnum = LBound(colnumarr) To UBound
(colnumarr)
For Each c In Range(tlcapscell,
blcapscell).Offset(0, colnum)
c.Value = UCase(c.Value)
Next
Next

Thanks...
 
J

JLGWhiz

You have probably figured it out by now. The LBound and UBound of your array
run from 0 To to the index count - 1. In your case 0 To 5. To get the
values of each index number in the arrary you can use colnumarr(0) for a
value of 2, colnumarr(1) for a value of 4, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top