View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Values in a MultiColumn Listbox

Dim sh as Worksheet
Dim i as Long
Dim sName as String

varr = Userform1.ListBox1.List
for i = lbound(varr,1) to Ubound(varr,1)
On Error Resume Next
set sh = Worksheets(varr(i,lbound(varr,2))
On Error goto 0
if not sh is nothing then
sName = Trim(varr(i,lbound(varr,2)+1))
sh.Name = sName
end if
Next

--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
I have a multicolumn listbox (2 cols). Col1 has values
A, B C etc that represent actual sheetnames in the
activeworkbook.
Against each of these values, the user has typed into
a textbox on the form, their true sheetnames. So the
listbox might look like
A Test1
B Test5
etc.

How may I now rename the sheets with the user's
true sheetnames, please?

Regards.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003