johnbird1988
Board Regular
- Joined
- Oct 6, 2009
- Messages
- 199
Hello,
I have created the below code too populate a userform list box. However I am having problems adding a extra row.
In my range I have two columns; ProjectNumber and Project. All project have a number starting from 1. What I would like to do is at the begining add an extra row that is; 0 and (New). With 0 being the ProjectNumber and (New) being the Project.
I have added it into a IF statement because if there are no Projects then the only value in the listbox should be 0 and (New).
How can I add the extra row to my variant table. Been struggling to find anything on the internet too.
Thank you for your help.
John
I have created the below code too populate a userform list box. However I am having problems adding a extra row.
Code:
Function Populate_Listbox_Worksheet() As Variant
Dim vaData As Variant
nrow = Sheet9.Range("A1048576").End(xlUp).Row
If nrow < Range("ProjName").Row + 1 Then
vaData = Array("0", "(New)")
Else
vaData = Sheet9.Range("A4:B" & nrow).Value
End If
Populate_Listbox_Worksheet = vaData
End Function
In my range I have two columns; ProjectNumber and Project. All project have a number starting from 1. What I would like to do is at the begining add an extra row that is; 0 and (New). With 0 being the ProjectNumber and (New) being the Project.
I have added it into a IF statement because if there are no Projects then the only value in the listbox should be 0 and (New).
How can I add the extra row to my variant table. Been struggling to find anything on the internet too.
Thank you for your help.
John