I created a macro that take a table of data, where different values of inputs are column headers, and converts it to a list. The macro uses the function 'Application.InputBox(,,,,,,,8)' to get the range of the table to translate into a list. The macro worked fine when executed form the same workbook that had the table. I like this macro so much that I included it in an Addin for myself, but often when I execute this function from the Addin, the range that gets returned for the table is not from the same worksheet the the macro was executed form.
The code that gets the range is shown below:
Again, this is executed from an addin. When stepping through this code using breakpoint and "Watch" item, I see that ActiveSheet.Name is set to the sheet that I was on when I executed this function, but xRg.Worksheet.Name is not the same as the ActiveSheet.Name. I have several other worksheets open at the same time.Please Login or Register to view this content.
This function works fine when I only have one workbook open, but I would like it to work always so I don't need to close workbooks in order to use this.
Does anyone know what is going on or how to fix this?
Thanks
Bookmarks