View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
LeShark LeShark is offline
external usenet poster
 
Posts: 12
Default Formatting cells from a value in a Listbox

Dave

I did not bother with the formatting issue but filling the listbox is very
simple.

The attached code is executed from a button on the worksheet.

The sheet contains a range "companies" that has the list of companies

The userform just has a listbox called listbox1

here is the code


Private Sub UserForm_Initialize()
Dim co As Variant

With ListBox1

For Each co In Range("companies")
.AddItem co
Next

End With

hope this helps
End Sub





"davethewelder" wrote:

Hi, I have a spreadsheet, "Enter Data", to which is added a list of
companies and corresponding values. I have a macro to convert them into the
correct format and position on another spreadsheet, "Template". There is
stil one manual process which requires some font changing and border
formatting for one company in the list. I can record a macro to do this
formatting but i would like the user to pick the company from a listbox
which then formats the 13 cell ranges. I have tried to create the listbox on
the spreadsheet and also on a form but I am unable to mange to populate the
listbox with the company valuse.

I have looked at the examples posted but I have not been able to get them to
run on this spreadsheet.

Can anyone help.

Thanks in advance.

Davie