Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If statements with drop down toolbar


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default If statements with drop down toolbar

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using IF statements with a drop-down list Steve Jamison Excel Discussion (Misc queries) 3 April 26th 23 11:45 AM
referencing drop down menu values in IF-then statements? Powder Coating Mike Excel Discussion (Misc queries) 4 May 7th 08 02:51 AM
Drop TB into Financial Statements formula? Ang Excel Worksheet Functions 2 January 14th 07 10:33 PM
Toolbar Forms & If statements A.S. Excel Discussion (Misc queries) 2 January 24th 06 10:01 PM
drop down boxes and if then statements Aversin[_3_] Excel Programming 2 April 28th 04 10:19 PM


All times are GMT +1. The time now is 11:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"