Assign range to userform labels and textboxes

D

danmack

Hi all,

I'm putting together a Userform which is to be used to amend existin
data in an excel worksheet. I've already put together a userform to loa
the data-no problems...however i'm struggling with my limited knowledg
to work out this next phase.

The following code selects all the columns in the first row an
populates the combo box with a list of part numbers from column A (s
row to amend can be selected) which is fine. The rest of the cod
selects all the headings in Row 1 (for transfer into the captio
property of my Userform Labels) when i only want the first 13 (rang
A1:13)-I can't work out the syntax needed to do this.

Private Sub UserForm_Activate()
With Data.Cells(1).CurrentRegion
Cbo_Partno.List = .Offset(1).Value
sq = .Rows(1)
End With

For j = 1 To UBound(sq, 2)
Me("Label" & j).Caption = sq(1, j)
Next

End Sub

Hopefully you guys can help with this and i'll learn something ne
(again!!)

Thank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top