VBA Macro To Use Solver On User Selected Column Of Data?
Jul 24, 2014
I am trying to write this macro so that I can optimize 181 outputs based on 2 inputs (columns A and B are inputs). Each row has a single output at the end of the row that I am trying to minimize. I want to be able to select as many of the rows that I want and have the code optimize each individual row. So far I can't get it to let me use variable cell references for the "ByChange:="$A$3,$B$3"." This is the hang up that is not letting me increment the macro to the next row. The macro works currently for the single selected cell, but until I can vary the ByChange portion, I can't automate it.
View 1 Replies
ADVERTISEMENT
Nov 7, 2012
I would like to delete a column using data validation list. for example :
i have a data validation INPUT list in cell A1 (Part No., Supplier 1, Supplier 2, Supplier 3) the heading start from B2,C2,D2,E2,F2. If user select Supplier 1 from data validation list in cell A1, the column Supplier 1 [c2] should be deleted.
And/or also if in cell B1 have a data validation INPUT row list (Part no.) & if user select part no.,
the selected part no. row should be deleted.
View 1 Replies
View Related
Mar 3, 2007
how can I generate a user defined function(UDF) that triggers excel's solver? I have a set of 5 constraints and one objective that is to be maximized. I want to perform a senstivity analysis for my objective changing these 5 constraints. So I want the UDF to take all the 5 constraints and return me the optimized value (obtained from excel's solver) for the objective cell.
View 8 Replies
View Related
Oct 24, 2011
how can I provide a chart that display as a line chart twelve months of data for the item selected starting or ending on the data that I have selected
View 4 Replies
View Related
Apr 7, 2014
I have a workbook that has three worksheets. The ASU Database sheet contains part numbers and descriptions including specific details that are selected from pull down data validation lists that are named on the third worksheet. I want to have a front end on the first worksheet that has similar data validation lists for the user to select from to create a search criteria that will create a worksheet with only the rows that meet this criteria. I am not sure what method to use to accomplish this.
View 2 Replies
View Related
Jun 20, 2014
I am trying to do is to make it so that users can enter data into my form (I have managed to create the form and am working on trying to figure out how to get the info entered into the form to appear in my worksheet) and then the data will cause the information to, basically, compile sentences that I want to appear in one of three cells at the bottom of the worksheet.
Essentially, at this point in time, the end goal is to make 3 cells that contain text. Eventually, this text will be indexed elsewhere, but that is for the next person to deal with. I am creating a prototype that I want to present as a process improvement.
So, when the user selects 3 in cell D7 I want the text "Customer purchased 3 Widgets at $20 each." to print in cell 82B.
I also want the user to be able to copy and paste some customer records from another program directly into a cell in the form that will just print (unchanged) into one of these boxes, too.
Lastly, I want the user to be able to select checkboxes that will, when selected, print a comment that will print in two of these boxes. For example, if the user selects yes for cell D26 then I want the text "Customer not eligible for free shipping" to appear in both cells C82 and D82.
View 5 Replies
View Related
Feb 28, 2008
I want to create a macro that when selected will take me to a specific row and column in another worksheet, this will be the outcome of two cells, so far i have it to take me to the row but no reference to the column can anyone help.
code i have so far.
Sub Find_Todays_Date()
Dim FindString As Date
Dim Rng As Range
FindString = Sheets("Dynamic Whereabouts").Range("B1:B1")
With Sheets("whereabouts 08").Range("A:A")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
View 9 Replies
View Related
Sep 10, 2006
I have a cell, D5, which is the sum of three other cells, A5 B5 and C5. (all currently empty). Cells A1 through C4 are filled with various numbers.
What I've been trying to do is use solver to say: Make D5 equal 200, do it by manipulating only A5 B5 and C5, and make it subject to the constraint that A5 must equal a value selected from A1:A4, and B5 must equal a value from B1:B4, and C5 ...etc. I have deliberately set it up so that there is only one solution.
I was doing fine until trying to create the constraints. How can I make a constraint that says "this cell" must equal "one of the following cells"? And if I can't do that, is there an alternate method of achieving the same result?
View 9 Replies
View Related
Dec 21, 2006
can I program a macro to run solver? ...
View 9 Replies
View Related
Nov 2, 2006
I'm trying to run a macro which will allow me to run solver and keep the solution.. I have managed to get the macro to work. However, does anyone knows how I can ensure that solver's solution can be automatically saved without prompting the user whether to save the solution?
View 2 Replies
View Related
Dec 2, 2013
In my spreadsheet, one user defined function i.e. pfizer is there which I want to convert into macro and use it in column H of sheet2 [sheets("sheet2").columns("H:H").select]
What should be the VBA code for this.
when I have started the macro with keyword as application. . the function is not populated.
-->I am able to populate the data with the formula like this = pfizer("I1")
View 1 Replies
View Related
Jan 11, 2009
I have a problem with a macro in Excel 2007. It invokes
solver and creates an answer report. Please find the VB
code for macro, below.
View 7 Replies
View Related
Jan 25, 2010
When I run a group of macros for some reason after the marcro runs and I hit F2 excel crashes.
I have figured out that it is one of the marcros that makes the excel crash. It is only when I run the solver application. The code is below. Any thoughts why hitting F2 after running this marcro would crash the machine?
View 10 Replies
View Related
Mar 31, 2014
I currently have a macro that takes a user selected name and date and creates a time sheet for the selected name. This works just fine, however i have to select each individual person and run the macro for each person, how to automate that part of the macro, so it will automatically create the said sheet for all person at once, rather than me doing it manually.
[Code] .....
The 'CurrentMonth' variable is user selected from a list, and will remain that way.
View 4 Replies
View Related
Dec 3, 2008
I have a form that asks at what row the user wants to start with a selected range then how many rows to select. There will always be 21 columns selected with this range. I am still learning but it has to do with something on how I am setting the Start object. It is not being recognized.
Dim Row As Long
Dim Selection As Long
Dim Start As Range
Row = txtStartRow
Selection = txtHowMany
Set Start = Range("A" & txtStartRow).Select
Range(Start & ActiveCell.Offset(Selection, 20)).Select
View 9 Replies
View Related
Sep 28, 2008
A single macro that I can assign to a button and, when clicked, will compute 3 solver solutions instantly without the solver boxes popping up.
My problems
I am having trouble with the "ValueOf:=" part. In my code below, I am trying to tell it to go to either cell b14, b15, or b16, select that value which will be a number, and use that number as the "ValueOf". The ValueOf is the number I am ultimately trying to achieve using Solver. Range("B##").select doesn't work but I need to somehow select that number in that cell and tell solver to use that number when computing.
If I manually type a number for the "ValueOf:="0.952975095" it will compute it correctly but manually typing this number in each time defeats the purpose of creating this macro. The whole purpose of this macro is so I don't have to manually type in numbers.
Also, recording a macro with multiple solver steps hasn't worked. When the macro is ran with multiple Solver solutions, it only computes one solution... the last one. I think the last data is stored in the Solver application but I'm not sure how to erase it, and start a new solver setup. Anyways, you all would know better than I would.
What's important?
It needs to compute in a certain order. In this order: Cells D14, then D15, Finally D16. That's probably not a big deal though.
My code
Sub Macro1()
'
' Macro1 Macro
'
SolverOk SetCell:="$C$14", MaxMinVal:=3, ValueOf:=Range("B14").Select, ByChange:= _
"$D$14"
SolverSolve UserFinish:=True
SOLVERreset
View 4 Replies
View Related
Oct 18, 2006
I have a macro that loops through several workbooks and copies data to one common sheet. Works great with one flaw that I have not been able to resolve. I am using the End Property example below, this works great as long as there are more than one cell with data. With one cell having data this takes you to the bottom of the sheet.
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Need code to select from a specific cell to the last cell in that column with data where when the selected cell is the only one with data that would be the only cell selected.
View 2 Replies
View Related
Jun 5, 2006
how you would write a macro to move a selection of sheets to a workbook called Digi's in the D drive. Also if there isn't a Workbook called Digi's already it needs to add one. I've found some code to loop through sheets but nothing to show what sheets the user has selected
View 4 Replies
View Related
Aug 5, 2008
I would like the user to select two files, the macro then inputs a formula that includes vlookup to the other sheet. However i am not sure how to reference each workbook.
Sub InsertLocationContents()
Dim rng As Range
Dim LastRow As Long
'OPEN CSV FILE WITH LOCATION CONTENTS
csvFN = Application. GetOpenFilename(Title:="Select Location Contents csv file")
If csvFN = False Then
' They pressed Cancel
MsgBox "Stopping because you did not select a file"
Exit Sub
Else
Workbooks.Open Filename:=csvFN
Workbooks.OpenText Filename:= _
csvFN, Origin:=437 _ .............................
View 9 Replies
View Related
Nov 18, 2012
Writing a macro to run SOLVER on a linear program. I have twenty tabs, each with a linear program and a solver already set up (constraints, cells to change, and cell to maximize). I would like to run a sub that will solve each tab's LP by running the tab's SOLVER...
If it makes it easier, my cell to maximize is I17, by changing B16:H16, subject to I20:I40 SolverAdd -> SolverOk -> SolverSolve
View 1 Replies
View Related
Mar 23, 2013
I have written this macro below to run solver multiple times. It saves the solver results on a line and then inserts a new line for the next solver run.
I would like to save the final Objective Function Value from solver in each line as well as its result. Is there any way to do this?
Sub run()
'
' run Macro
' run solver
'
' Keyboard Shortcut: Ctrl+n
'
Application.ScreenUpdating = False
Range("B4:T13").Select
[Code] .........
View 2 Replies
View Related
Nov 9, 2013
I have attached link to a resource planner I have cobbled together and am stuck on the last piece of code. The "Assign Project" button needs to take the project and resource from the drop-down lists and populate the column of that resource with the project name between the dates that have been selected.
Resource Planner: [URL] ....
I'm using Excel 2010 and Windows 7
View 6 Replies
View Related
Dec 1, 2013
ID Name QTY Price
1 John 5 15
2 Jim 6 20
3 Sue 10 200
4 Fred 12 125
1 Tim 7 26
4 Sue 10 100
I need macro to loop through all data and generate this table in another worksheet
1 John 5 15 Tim 7 26
2 Jim 6 20
3 Sue 10 200
4 Fred 12 125 Sue 10 100
Each data in a row in the new table will occupy a different cell.
View 3 Replies
View Related
Apr 27, 2014
I am using this code to copy columns C,D, and P from a user selected workbook into position C,D,E of workbook "Checklist.xlsx" (the one from were I run the VBA code). I don't have a clue about VBA, just have been gathering info, but the code works pretty fine. The only issue is that it opens twice the workbook "wbExt" hence the system prompts me if i want to reopen the already open workbook.
Some questions:
1) Is there a way to copy the 3 columns at once? something like "Columns("C:D, P").Select".
2) Is there a way to select the workbook from were to copy the column without needing it to actually open?
3) is there a way to paste the columns starting from row 3 instead of row 1 (Range("C1").Select)?
View 2 Replies
View Related
Jul 21, 2014
Within a worksheet, I have several radio buttons, allowing the user to select only one of them. Using VBA, how do I recognize which radio button the user selected?
View 1 Replies
View Related
May 3, 2008
On the first row of a spreadsheet template is a <hidden> contiguous series of conditionally formatted cells (range name "stdRow" =production!$1:$1), with formulas, that I want a user to be able to easily insert at whatever row they might be in a worksheet.
If, for example, the user is at D24, then clicks the [InsertRow] button that I have positioned at the top of the worksheet (in a fixed pane), I want the attached macro to insert an instance of "stdRow" directly underneath the user position (at row 25, in this case). The use's position should still be at D24 when the macro finishes. If the user clicks the button multiple times, multiple rows should be inserted (again, without changing the user's position).
This is what I have tried so far:
View 13 Replies
View Related
Feb 9, 2010
The User has made multiple selections with the mouse. The spreadsheet is filtered. The user will usually make different multiple selections on the following columns: A and X through to AR (inclusive).
I just need some code to capture these various multiple selected ranges so that I can copy the selected range as shown below:
View 3 Replies
View Related
Nov 14, 2007
I want to do a concatenate for multiple fields, but want the user to specify which cells should be concatenated by entering this in a few fields. What does this formula (or VBA) look like?
Let's assume there is the possibility to concatenate a maximum of 4 cells. Call the 3 cells that will be concatenated cell1, cell2, cell3 and cell4.
On the first sheet of the workbook the user enters the following:
cell1 = Sheet2!A4
cell2 = Sheet2!B4
cell3 = Sheet2!C4
cell4 = Sheet2!D4
Here are some cells and their values:
Sheet2!A4 = Hel
Sheet2!B4 = lo
Sheet2!C4 = World
Sheet2!D4 =
Upon enterring the information after the = sign for the cell1, cell2 and cell3, the formula for the concatenate becomes: =CONCATENATE(Sheet2!A4, Sheet2!B4,Sheet2!C4 ).
The result of the formula is: HelloWorld
If I now change the values of cell1, cell2, cell3, and cell4 the following should happen:
cell1 = Sheet2!B4
cell2 = Sheet2!C4
cell3 =
cell4 =
The formula for the concatenate becomes: =CONCATENATE(Sheet2!B4, Sheet2!C4).
The result of the formula is: loWorld
View 9 Replies
View Related
May 15, 2007
I'm trying to create a macro that allows users to hide or unhide selected rows, either via toggle or userform. The macro I have looks like this, but for some reason it doesn't hide the rows:
Sub Hide_Range()
Dim UserRange As Range
DefaultRange = Selection.Address
Set UserRange = Application.InputBox _
(Prompt:="Select Range to Hide:", _
Title:="Hide Range", _
Default:=DefaultRange, _
Type:=8)
Rows.Select
Selection.EntireRow.Hidden = True
End Sub
what's wrong with my code and how I can further develop it to let the user decide whether to hide or unhide the selected rows?
View 3 Replies
View Related
May 26, 2009
Is there a way to prevent the Workbook_SheetChange event macro from triggering when I run Excel's Solver?
The solver goes through 100 or so iterations changing multiple cells each of which seemed to trigger the Workbook_SheetChange event. If there was a Solver Run event, I could turn off application events, but as far as I know such an event does not exist.
View 9 Replies
View Related