View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
N.F[_2_] N.F[_2_] is offline
external usenet poster
 
Posts: 65
Default CODE Assistance needed PLEASE please please

Hi. Anyone can disect this code and see whats wrong with it. When I hit
debug, it highlights the 5th line in the first paragraph.
I need the listbox in sheet1 to get the values in sheet ("database") and
once I click the command button in the userform I need it to display the list
values in ListBox1 on an array style ( a row with the values) on sheet 1.
This is what I came up with:
I just cant get the values selected in the listbox to show in a row style in
sheet 1.


Public Sub Closefrm1_Click()
NumColumns= ListBox1.ListCount
Set rng=Sheet1.Range("Header")
rng.Clear
rng.Resize(1,NumCoulumns).Name=Sheet1.Range("Heade r")

k=0
For Each cell in Sheet1.Range("Header")
Cell.Value=ListBox1.List(k)
K=K+1

ListBox1.Clear
ListBox2.Clear

UserForm1.Hide
End Sub