Hi all
I've put together a listbox which allows a user to view and edit/delete information on a worksheet contained within an add-in
When set as an add-in it works fine at picking up the formatting/number of columns/rows on the worksheet but picks up the data from the activesheet.
This is to do with way Userform1 picks up any information for sure! But how do I reference the sheet to only grab data from $DSCMLIST and not the activesheet.
Attachment enclosed. I'm using Excel 2007.
Any help much appreciated!
Cheers
Danny.
Code:Private Sub Userform_Initialize() Dim Sourcewb As Workbook Set Sourcewb = ThisWorkbook ColCnt = Sourcewb.Worksheets("$DSCMLIST").UsedRange.Columns.Count Set Rng = Sourcewb.Worksheets("$DSCMLIST").UsedRange With ListBox1 .ColumnCount = ColCnt .RowSource = Rng.Address cw = "" For c = 1 To .ColumnCount cw = cw & Rng.Columns(c).Width & ";" Next c .ColumnWidths = cw .ListIndex = 0 End With End Sub
/
----
OOO
Hi
Didn't test this but I think the range will have to be in the form
[workbookname]sheetname!range
So using your example it could be something like
You will have to put the code bits in the relevant place..Code:dim strr as string strr = "[" & thisworkbook.name & "]$DSCMLIST!" & rng.address .rowsource = strr
HTH
rylo
Thanks for the info, but no luck with that unfortunately. Any other suggestions?
/
----
OOO
Hi
Have both the workbooks open, and manually put in the rowsource for the userform so that it comes from the right place. What does the full name look like?
rylo
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks