View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
depuyus depuyus is offline
external usenet poster
 
Posts: 1
Default List Selection to First Empty Row

I have inherited a worksheet which has a macro that places the selectio
from a listbox into a cell on a worksheet. That becomes the range tha
is placed on the main worksheet when the user clicks ok. The proble
is that range is then placed wherever the cursor is in the mai
worksheet. I need to alter or add to the vba language to make th
selection go to the first empty row in column A so that the user canno
place the entry anywhere but in column A. Could anyone please look a
this for me? Thank you in advance for any suggestions

Private Sub CommandButton1_Click()
'if the listindex of listbox equals -1 ... nothing selected
If ListBox1.ListIndex = -1 Then
MsgBox "No item selected", vbExclamation
Exit Sub
End If
Range("SelectionLink") = ListBox1.ListIndex + 1
Selection.Cells(1) = Worksheets("Products").Range("D1")
Selection.Cells(1).Offset(0, 1) = Worksheets("Products").Range("E1")
Unload Me
End Su

--
Message posted from http://www.ExcelForum.com