Create (variable) number of string variables?

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

Can I allow a user to select a range, count the columns, and create a string
variable for each column selected? Something like strCol1 to
strCol(cntCols)?

Ed
 
Not sure I understand, but:

"strCol" & Selection.Columns.Count

may be what you're looking for.
 
You probably need an array. Look it up in help.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Dim strCol() as String
redim strCol(1 to Selection.Columns.count)

i = 0
for each cell in Selection.Rows(1).Cells
i = i + 1
strCol(i) = cell.Text
Next
 
Thank you, one and all. Now it looks like I get to learn something new!

Ed
 

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

Back
Top