Trouble manipulating worksheet chosen from combo box
I have filled four combo boxes with the worksheet names from the workbook. I
want to copy a (different) range from each worksheet chosen and paste them together into a different worksheet within the workbook. I am having trouble at the point where I am getting the results of the combo box to actually call the chosen worksheet and get the range. The line of code is: With cboInv.Range("B2:AF3580") 'cboInv is the first combobox variable at this point I get this error message: Run time error '91': Object variable or With variable block not set I have the statement "Dim cboInv as Worksheet" at the top of the procedure, but if I remove that I still get a compile error on the ".Range" part of the code: Method or data member not found It's probably something basic I'm missing; perhaps someone could point it out? |
Trouble manipulating worksheet chosen from combo box
"PV Jefe" schreef in bericht ... I have filled four combo boxes with the worksheet names from the workbook. I want to copy a (different) range from each worksheet chosen and paste them together into a different worksheet within the workbook. I am having trouble at the point where I am getting the results of the combo box to actually call the chosen worksheet and get the range. The line of code is: With cboInv.Range("B2:AF3580") 'cboInv is the first combobox variable If in the combobox i.e. 'Sheet1' is selected, it is just text but it should be an object. Try this: With Worksheets(cboInv.Text).Range("B2:AF3580") at this point I get this error message: Run time error '91': Object variable or With variable block not set I have the statement "Dim cboInv as Worksheet" at the top of the procedure, but if I remove that I still get a compile error on the ".Range" part of the code: Method or data member not found It's probably something basic I'm missing; perhaps someone could point it out? |
Trouble manipulating worksheet chosen from combo box
Hi moon,
Muchas Gracias - that was perfect! I knew there was some little (!) thing I needed. I appreciate your help very much! |
All times are GMT +1. The time now is 03:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com