ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   CODE Assistance needed PLEASE please please (https://www.excelbanter.com/excel-discussion-misc-queries/149490-code-assistance-needed-please-please-please.html)

N.F[_2_]

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


All times are GMT +1. The time now is 11:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com