Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The following code does the following: Users selects/opens a file- data from the selected file gets copied to the data in the source worksheet/file Sub test() Dim file_open As Variant Dim WB As Workbook file_open = Application.GetOpenFilename("Excel Files (*.xls), *.xls") Set WB = Workbooks.Open(Filename:=file_open) With ThisWorkbook.Worksheets("Review Schedule & Metrics") ' read data from the source workbook ..Range("A10").Formula = WB.Worksheets("PM").Range("A10").Formula End With WB.Close False ' close the source workbook without saving any changes Set WB = Nothing ' free memory Application.ScreenUpdating = True ' turn on the screen updating End Sub PROPOSED: 1. Add a dropdown toolbar box where users can select an item (total of 6 items) 2. Each item in the list refers to a different set of data (i.e different range) 3. Depending on what item is selected, the code should go to the specified range for that item and copy over the data (as what is happening at the moment anyway) For example: If user selects item 1, this will copy over range A10 - A20. If user selects item 2, this will copy over range A99 - A49.. etc I am not sure of how i will be using the IF statements and making references to items in the drop down toolbar button? Many thanks in advance -- periro16 ------------------------------------------------------------------------ periro16's Profile: http://www.excelforum.com/member.php...o&userid=26345 View this thread: http://www.excelforum.com/showthread...hreadid=469588 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
for i = 0 to Combobox1.Listcount - 1
if Combobox1.Selected(i) then sName = Combobox1.List(i) ' not sure what is in the combobox dropdown, so . . . end if Next -- Regards, Tom Ogilvy "periro16" wrote in message ... The following code does the following: Users selects/opens a file- data from the selected file gets copied to the data in the source worksheet/file Sub test() Dim file_open As Variant Dim WB As Workbook file_open = Application.GetOpenFilename("Excel Files (*.xls), *.xls") Set WB = Workbooks.Open(Filename:=file_open) With ThisWorkbook.Worksheets("Review Schedule & Metrics") ' read data from the source workbook Range("A10").Formula = WB.Worksheets("PM").Range("A10").Formula End With WB.Close False ' close the source workbook without saving any changes Set WB = Nothing ' free memory Application.ScreenUpdating = True ' turn on the screen updating End Sub PROPOSED: 1. Add a dropdown toolbar box where users can select an item (total of 6 items) 2. Each item in the list refers to a different set of data (i.e different range) 3. Depending on what item is selected, the code should go to the specified range for that item and copy over the data (as what is happening at the moment anyway) For example: If user selects item 1, this will copy over range A10 - A20. If user selects item 2, this will copy over range A99 - A49.. etc I am not sure of how i will be using the IF statements and making references to items in the drop down toolbar button? Many thanks in advance -- periro16 ------------------------------------------------------------------------ periro16's Profile: http://www.excelforum.com/member.php...o&userid=26345 View this thread: http://www.excelforum.com/showthread...hreadid=469588 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using IF statements with a drop-down list | Excel Discussion (Misc queries) | |||
referencing drop down menu values in IF-then statements? | Excel Discussion (Misc queries) | |||
Drop TB into Financial Statements formula? | Excel Worksheet Functions | |||
Toolbar Forms & If statements | Excel Discussion (Misc queries) | |||
drop down boxes and if then statements | Excel Programming |