T
TBA
Below is a bit of code I use to store header values into a one-dimensional
array, along with the some less important information like the column width
of the column each header is in (it's important to have this, trust me
heh). All variables have been declared.
TblWidth = 0
For Each Cell In Range("Database").Rows(1).Cells
TblWidth = TblWidth + 1
Headers(TblWidth) = Cell.Value
HeaderWidths(TblWidth) = Cell.ColumnWidth
Next Cell
What I'd also like to do is create a one-dimensional Range array variable,
say HeadersRng(a), that will store the location of each header as a range.
I've tried this:
Dim HeadersRng(100) as Range
Range("Database").Rows(1).Columns(1).Select
For a = 1 To TblWidth
HeadersRng(a) = ActiveCell.Address
ActiveCell.Offset(0, 1).Select
Next a
I'm getting a Run-time error '91': Object variable or With block variable
not set.
I realize there may be a better way to loop through this process, perhaps
even in the first loop I referenced. However, I feel that I am missing
something fundamental here. Am I close? Any and all help appreciated.
Thanks!
-gk-
PS this group rocks! thanks so much for all the help I've received so far.
array, along with the some less important information like the column width
of the column each header is in (it's important to have this, trust me
heh). All variables have been declared.
TblWidth = 0
For Each Cell In Range("Database").Rows(1).Cells
TblWidth = TblWidth + 1
Headers(TblWidth) = Cell.Value
HeaderWidths(TblWidth) = Cell.ColumnWidth
Next Cell
What I'd also like to do is create a one-dimensional Range array variable,
say HeadersRng(a), that will store the location of each header as a range.
I've tried this:
Dim HeadersRng(100) as Range
Range("Database").Rows(1).Columns(1).Select
For a = 1 To TblWidth
HeadersRng(a) = ActiveCell.Address
ActiveCell.Offset(0, 1).Select
Next a
I'm getting a Run-time error '91': Object variable or With block variable
not set.
I realize there may be a better way to loop through this process, perhaps
even in the first loop I referenced. However, I feel that I am missing
something fundamental here. Am I close? Any and all help appreciated.
Thanks!
-gk-
PS this group rocks! thanks so much for all the help I've received so far.