Macro To Input A Formula
Mar 26, 2009
i need a macro to insert the formula i have in Column M row 3, and insert it all the way down to the last letter that is contained in column k. So in this example The Last Letter in Column K is AQ, ( i dont physically mean last i mean last in alphabetical order in excel , such as ( W X Y Z, AB, AC , AD ) AD would be last.
So since AQ is last it would insert the formula 43 times, which is AQ. THe AFter tab should clear any confusion up because this is how it looks finished. I use various sheets like this so the last letter changes, so having this macro be dynamic and not attached to a sheet name would be ideal.
View 2 Replies
ADVERTISEMENT
Nov 10, 2011
I often have to research long sheets of data, which requires filling data in on my research sheet from several different sources. The research sheet has a file # in A and a vendor # in C. The data sources have the file #s & vendor #s in varying columns, but I use a pivot table to end up with file # in A, vendor # in B and the needed data in C.
The length of the research sheet varies from month to month - often 800-900 rows, so you can imagine how tedious it is to find the correct file #/vendor # combination to plug the data in. (Many of the rows on the research sheet will not have a row on the data source sheet.)
I managed to get an array formula in one of the columns on the research sheet that actually DOES work:
Code:
{=INDEX('Acct Activity'!C$1:C$7,MATCH(A7&C7,'Acct Activity'!A$1:A$7&'Acct Activity'!B$1:B$7,0))}
But the problem is that it returns #N/A in any row that doesn't have any data. This messes up the sum formula in the farthest right column. So, I tried to incorporate an ISERROR in with the formula, but couldn't get it to work; it left all the cells blank.
In the meantime, I got to thinking that, since there are up to 3 columns requiring data on the research sheet & each column's data comes from a different source, wouldn't it be great to have a macro where I could use a couple of Input Boxes: 1 that would let me click on the column where the data NEEDS to go & 1 that would let me tell it (either by typing the worksheet name or by clicking on the worksheet " PREFERRED " where the data come from)!
So, I spent the entire day yesterday trying to make any of that work & can NOT figure it out! I got the macro to pop up the first input box, & can key in the column letter, but clicking OK doesn't do anything. Yesterday, I had it so I could click OK & the box would go away, but nothing else happened & the second box wouldn't work right.
THEN, I started trying to figure out how to do an array formula in a macro & my head nearly exploded! I have a terrible time trying to understand written descriptions if they're in "tech speak", so it was all greek to me.
Here is all the farther I got with the macro:
Code:
Sub ClearingRsch()
' Jenny 10092011
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
.DisplayAlerts = False
[Code] ......
View 9 Replies
View Related
Jul 22, 2014
Sample Data from "Demand Planning Prem" worksheet
Date
SKU
Name
Begin FG's
[Code]....
This worksheet has around 40,000 records, and I need to create a Macro that will ask the user for a date, and when the user enters a date the macro goes through column A and finds all of the matching dates and then replaces the numbers (along with the formulas) in the corresponding Add Returns cells (column E) with 0's.
I have only been able to create an inputbox, but I am completely lost regarding the criteria due to being very new to VBA.
Sub ClearData()
Dim EnterDate As Date
Dim msg As String
[Code].....
View 2 Replies
View Related
Jul 24, 2014
I am trying to create a macro which gives me an input box. I need to enter 2 numbers into the input box. It would be as follows:
Input Box Msg 1 - "What is your labor cost?" (NUM1)
Input Box Msg 2 - "What is your productivity rate?" (NUM2)
Then I need the macro to take this info and enter it into a formula which changes according to the row which you are on. (I need the macro to work based on which ever cell I currently have selected). The formula would be this if I currently had a cell on row 10 selected:
=(NUM1*(NUM2*$H10))/$H10
So, if I currently had cell L10 selected, and I ran the macro and put 100 in for "NUM1" and 10 for "NUM2" and my sheet had 20 in cell H10, then the macro would enter the number 1,000 into cell L10. If I had L500 selected, then the macro would enter the final number into cell L500 based on what value H500 contained.
View 9 Replies
View Related
Apr 23, 2009
I'm having some trouble trying to get excel to input a formula into a cell. I'm still a novice at VBA right now, so I don't think my problem will be too much of a brain buster.
I want a formula in Cell A6 (and I already know it correctly works) in this format: =E6&VLOOKUP(I6,'FA-Fund Data'!B$1:C$2000,2,FALSE)&J6
View 3 Replies
View Related
Oct 9, 2012
I have recorded the following marco and it works fine. I would like to modify it so the user would highlight a range of cells rather than have the fixed area :
"'ConsExecProp@20120920'!R4C5:R113C21"
What code lines would need to be added?
Application.Goto Reference:="R4C5"
ActiveWorkbook.PivotCaches.Create(SourceType:=xlConsolidation, SourceData:= _
Array("'ConsExecProp@20120920'!R4C5:R113C21"), Version:=xlPivotTableVersion12 _
[code]....
View 4 Replies
View Related
May 14, 2008
i'm having trouble formating a cell to accept either user input or a equation i've made. i would like it to accept the user input and when there is no input to use the equation i have.
View 8 Replies
View Related
Apr 27, 2009
I need to display two separate values from a given input, but not exceed a specified number for that cell. I have this so far except for the maximum number that can be displayed; Example for what I want below ....
View 8 Replies
View Related
May 25, 2009
I was wondering how you can protect a formula but still allow editing in the cell. Right now I have certain columns locked while allowing others to be edited. I have a formula in one column that needs to be edited if need be but if they make a mistake and hit delete then my formula disappears and it throws the whole sheet off. Is there a way to protect your formula maybe by putting it in a different cell that can be locked and referencing the cell where they can input?
View 9 Replies
View Related
Nov 25, 2008
I'm using Excel 2007 and the sheet has 238536 rows containing 26412 ranges.
The first 5 rows in each range contains data. I wish to input into the sixth cell of every range a formula. Not essential but I'd prefer it to be formatted blue.
I attach short s/s to illustrate my need.
View 2 Replies
View Related
Jan 18, 2012
I am trying to input this formula (=IF(M14
View 4 Replies
View Related
Jun 8, 2007
I have the following (intense) formula
=SUMPRODUCT(--ISNUMBER(SEARCH(MID(A5,{1,4,8,12,16},3),B5)))>=3
I was wanting to make either 3 input boxes or 1 if thats possible that basically you click and it captures the column you want the answer in, and then the two columns the data is in. It then places the formula down in that column with the answers based on what your input was.
I would want the range to be atleast 1 to 6000 rows (just in case)
View 9 Replies
View Related
Jan 14, 2009
I have an excel file with several rows of data in it, and have a macro currently written to fill out a blank form from the information in a given row. I was wondering if there is a way to prompt the user to input which row you want the data to be pulled from.
For example:
Which row to input data from?
- 4
Then have the macro run, pulling the data from the cells in row 4, rather than row 2, which is how I have written it to begin with.
I didnt write the code from scratch, I just used the record function and it traced my actions, and does what I want it to do, but only for the data in row 2...and I want to be able to specify which row to pull data from.
View 9 Replies
View Related
Sep 15, 2014
I would like a cell to have user input. If there is no input then the cell should reference a value in another cell. My strategy was to use a formula in another cell to check to see if the user input cell was empty. If it was empty then the formula propagated the cell. If it had user inputted data then it stayed like it was.
Here is an example:
Begin Invent
1000
Gallons
End Invent
User input or
formula here
Gallons
Received
Gallons
Used
Gallons
I want the user to be able to input a value for the End Invent cell right below 1000. If there is no value I want that same cell to mirror the cell above it with the 1000 in it.
View 5 Replies
View Related
Jan 30, 2014
I am currently building a template for a project that will allow users to upload raw data which is then converted into a report. Part of this report is a cover page that has a graphic or picture on the front. My question to everyone is this...
Is there a way to put a formula either embeded into the picture, or above the picture, or putting the picture in the background so that the formula can do its beautiful magic and collect the information it needs for the cover?
My goal is for this picture to have the data on top of it without a border so the picture is the background image basically.
View 1 Replies
View Related
Jul 27, 2009
In column H: =IF(ISERROR(L4-J4-K4),"",IF(OR(K4="0", K4=""), L4-J4, L4-J4-K4))
So, if formula is going to come up with an error, I don't need to know. If it's not an error: L - J - K. Except that sometimes there isn't information in J or K, and the formula won't calcluate L - 0 - 0, unless I physically enter in zeros.
=IF(ISERROR(L4-J4-K4),"",IF(K4=""), L4-J4, L4-J4-K4))
and
=IF(ISERROR(L4-J4-K4),"", L4-J4-K4))
I don't want the people using this to have to enter in a plethora of zeros in order to force the calculation. What am I doing wrong? I've attached workbook with the relevant information in it. You can see in the middle that if there is nothing entered, it won't work right.
View 5 Replies
View Related
Jul 3, 2012
I want a user to be able to manually enter a formula into an input box which will then be used for other code elsewhere?
I have the following code but it does not want to work
HTML Code:
Dim fFormula As String
On Error Resume Next
Application.DisplayAlerts = False
[Code]....
View 7 Replies
View Related
Feb 19, 2009
I have a table with 4 radio buttons that assume certain data in three cells when they are selected. I have used the IF command to getthe information to appear in these boxes when the cooresponding radio button is selected.
I want the user to be able to either leave the selection as it is presented to them, have the option to change the data if it doesn't fit their scenerio.
Example: button 1 "Electric" makes the data "$0.12", "$per kWh", & "100%" appear in the three cells. Each button produces different data in these boxes, however if when button 1 is selected, the user's electric cost per kWh is $0.10, I want them to be able to type that in without changing my preset default.
View 9 Replies
View Related
Jul 21, 2012
I am trying to write a VBA macro that will mimic what i have already done in an excel worksheet i have made. The excel worksheet uses inputs for a heat exchanger and finds the temperature as it leaves the heat exchanger. This temperature is then the new input for the second line of the worksheet and it changes quite a few of the values in the sheet. I have the excel worksheet working where you just drage the row down and it does it automaticly, but i would like to have a VBA macro that all the values can be input in with the number of cycles until the heat exchanger equalizes out.
I am able to get the macro to work when it calculates just the first cycle, all the equations work my variables are ok for just one time. What i don't know how to do is make my program realize that it has to use the calculated temperature out of the heat exchanger as my new input for the heat exchanger. I know how to do it once so it is more of a syntax or understanding of a loop or an array for the values that are changing.
View 4 Replies
View Related
May 10, 2007
With guidance from this board in the past, I was directed to a macro that sorted information on a sheet (using values in column 1), opening a new sheet named by the sort title then copy/pasting all the relevant entries
The only restriction for this macro is the fact it is set to only sort information on sheet named Sheet1
I wanted to change this to an InputBox so the user can tell the macro which sheet to sort
View 9 Replies
View Related
Mar 28, 2009
I would like to do a Macro which requires user to go to a specific line which is variable in each work sheet. I would like to be able to enter the number and then delete all lines below that point and then continue with the balance of the macro.
Is there an easy way to pause the Macro and then restart it? Or is there a code that I can insert in the Macro to locate a specific Cell and then delete all lines below the next line?
View 4 Replies
View Related
Apr 18, 2009
I am looking for a macro which will help make my workbook more user friendly.
Is it possible to have a macro which when run brings up dialog boxes for user input into certain sheets etc.?
View 14 Replies
View Related
Nov 2, 2009
I have a document with multiple sheets that contain data for a specific date and are set up in chronological order. The last sheet(Final Sheet) has each row as a different date in a chronological range of 3 yrs and each row has 5 cells of data.
I need to write a macro that will take a 5 cell row from each sheet and place it in the correlating date/row in the Final Sheet. Each sheet is labeled as the date for which the data is from so the macro needs to match the sheet title to the date in column A of Final Sheet. Then place the 5 cells from the sheet into the correlating date/row. The macro would need to loop through and do this until it reaches the Final Sheet.
View 9 Replies
View Related
Feb 10, 2012
However, with this macro I am wanting to remove the Input Box that pops up and requires the user to hit 'enter' everytime the macro runs. Instead, I would like the macro to automatically insert the rows based upon the value of cell A1 without having to confirm with the Input Box.
Code:
Sub InsertRowsAndFillFormulas_caller()
Call InsertRowsAndFillFormulas
End Sub
[Code]....
Because I am such a novice with coding, if the response could be in a form where the entire macro code is spelled out on what needs to be changed. That way I can just copy and paste the macro response instead of having to try and figure out how to apply your suggestions to my existing code.
View 9 Replies
View Related
Jan 30, 2007
Macro to save as "xxx" Input box "___".xls
in the same folder as the original file?
xxx is defalut part of file name and input box for user to add criteria about file.xls
ie.. xxx_critera.xls
View 9 Replies
View Related
Apr 24, 2007
I would like to write a macro that would start by asking me something along the lines of, "Enter student # you want to print a report about." The # I enter would need to be stored as a variable in the VB code, and then my code would need to use the variable to do some search and replace operations. (Replace all instances of 10 (the default student number) with the variable I have specified).
I don't really know how to even start going about this. How do I get Excel to ask me for a variable, and then use that variable in code?
View 9 Replies
View Related
Nov 24, 2009
I have this macro in which the user clicks a button and it formats a file for them. I want a box next to the button where the user can enter a number first then click the button and then the file will use that number to calculate a column. Any help is appreciated.
For example part of my macro is this.
Lcol = Range("IV5").End(xlToLeft).Column + 1
Cells(5, Lcol) = "Total Cost"
Worksheets("sheet1").Range("u6").Formula = "=IFERROR((RC[-1]/RC[-3])*the number the person entered first,0)"
Lrow = Range("A" & Rows.Count).End(xlUp).row
Range("u6").AutoFill Destination:=Range("u6:u" & Lrow), Type:=xlFillDefault
With Range("u6:u" & Lrow)
.Copy
.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End With
Application.CutCopyMode = False
View 9 Replies
View Related
Mar 24, 2014
I have a column of hours spent working on a particular task, but I only want to add the hours that fall within a two week reporting period.
Is it correct to use the SUMIF formula? If so how do I write the formula to include the date range desired? Would it go under 'criteria'?
View 2 Replies
View Related
Jul 4, 2014
Tried to open the formulation area of the forum but get an error so posting here and when that is working I can move it.
I need to develop a formula that is used in our microbiology laboratory and the formula on paper is attached as I needed scientific symbols.
total plate count formula.JPG
View 5 Replies
View Related
Jan 13, 2010
Cell A5 has a Yes_No pull-down list for data validation. In cell B5, I want to display the value 0.002 only if A5 is "Yes". If A5 is "No", I want the user to be able to enter a number into the B5 cell without destroying the formula.
View 4 Replies
View Related