Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 56
Default hellllllp. (- multiple posts b/c of errors posting possibly)

Change "Steel List" to "Steel" and "Members" to "Horizontals".
When you go into the VBA editor, (ALT+F11), you can insert a userform
by clicking the Insert menu, then UserForm. The Controls toolbox
should appear and you can hover over the combobox and it will have a
tooltip that says ComboBox (not ListBox). Click on this. Then to
insert it into the form, click once and hold it to mark the top left
corner of the combobox, then move the mouse lower and to the right and
release the button to mark the bottom right corner.

Next, right click the ComboBox and click view code. It should bring
you to a code form where you can paste this:
Private Sub ComboBox1_Change()
ActiveCell.Value = ComboBox1.Value
UserForm1.Hide
End Sub

This will put whatever value you select into the active cell.
You need to put the code I wrote above into a module, then go to the
Excel menus and click Tools-Macro-Macros. Then select the macro
"PopulateAcceptList" and click options. You can add a shortcut key
here. Use something like semicolon or something else that isn't used
already by Excel.

So, my idea would be to go to the Horizontal sheet and put make the
active cell on the line where all your data is for a particular
horizontal. Then you could use the shortcut, (CTRL+;), and trigger
the code. This would open up the userform with the combobox and allow
you to select the appropriate steel for reinforcement.

You'll need to understand the code so that you can modify it to make
it work, however. Here's the code again with better comments.

Option Explicit
Public Sub PopulateAcceptList()
Dim shtSteel As Worksheet, shtTestMember As Worksheet
Dim lRow As Long
Dim lCurrent As Long
lCurrent = ActiveCell.Row
Set shtSteel = Sheets("Steel")
Set shtHorizontal = Sheets("Horizontal")
'first I'm setting variables for the two sheets since you need to
compare values on both sheets in order to determine which steels will
work.
'clear out old combobox items (we don't want steels that worked
for the last horizontal already in the box, only the ones that we
determine will work for this one)
UserForm1.ComboBox1.Clear
For lRow = 1 To shtSteel.UsedRange.Rows.Count
'calculations here to compare some calculation of the steel
to
'what would be required for the member - it may be a
combination of calculations from both sheets
'I added two variables, one from each sheet to show how this would
work
'In this case, lRow is the row that we're currently looping through in
order to determine if the steel will work
'lCurrent is the row of the horizontal that we're testing
If shtSteel.Cells(lRow, 3) shtHorizontal.Cells(lCurrent, 4)
Then
'this steel works - if it works, we add it to the combobox
so that you can select it
UserForm1.ComboBox1.AddItem shtSteel.Cells(lRow, 1).Value
End If
Next lRow
'after looping through all the possible steels and adding the ones
that work, we display
'the form with the combobox
UserForm1.Show
End Sub
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
Huge Apology - Multiple Posts In Error holmansworld Excel Discussion (Misc queries) 1 February 14th 09 08:46 AM
Apologies for multiple posts Michelle Excel Worksheet Functions 2 February 11th 09 05:03 PM
Hellllllp Can,t remember pasword chesjak Excel Worksheet Functions 3 April 30th 08 05:07 PM
Unable to read own posts or replied Posts Killer Excel Discussion (Misc queries) 3 June 6th 07 10:23 PM
Sorry for multiple posts... Lara Excel Discussion (Misc queries) 0 June 27th 06 06:02 PM


All times are GMT +1. The time now is 11:45 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"