If Vlookup formula can remain there even after running a Macro - excel

I have made a Data Entry form in which i have recorded a macro Using "Use Relative Reference" from developers tab.
I have also added vlookup formula so that if a certain value or word is selected many of the fields being pulled or appears automatically.
I have created a button named as "Save Data" and have recorded a macro in it
After adding all the values (few values manually, few values I pull via Vlookup) whenever i press the button "Save Data" it moves the all values from data entry form to another Main Worksheet.
However the problem is whenever i press the button it also removes the formula of Vlookup and I have to either paste Vlookup formula again or add the values manually. the formula of Vlookup is
=VLOOKUP(C12,Functions!F$2:J$20,3,0)
Can anyone suggest if even after pressing the button and after moving the data the formula should remain there and i do not have to put them manually again and again

Related

How to modify the value of a formula with a macro in an excel?

I have an excel file that has different formulas. What I am looking for is to modify only one element of that formula since due to the process that I am working on, the formula could change, but the period (eg 202112) is a field that must always exist, so I think I could not generate the formulas with a macro, since these are modified by another user. Is it possible to add a variable to the formula and update/change the value by pressing a button?
The following table is only to explain what I need, it is too simple, but it is not to enter the long formulas.
I would like to assign a macro to the button so that when pressing it the value of the variable "Period" is updated, for example 202112
Without using macro you should change the excel recalculates settings;
-In Excel, click the Microsoft Office Button, click Excel Options, and then click the Formulas category and in the Calculation options section, under Workbook Calculation, click Manual and uncheck the checkbox.
Use this formula for your Ids+Period column;
=B2&C2&TEXT(TODAY(),"yyyymm")
To update your cell formula (or date). You should click the cell and after that command line and click enter. Done!

Use common dropdown across multiple worksheets to change single cell

I have a large file with a Scenario Manager, where changing a single cell on the Summary worksheet changes the visible scenario throughout the rest of the workbook. Data Tables are working a treat providing the headline values for each option.
I'd like to have a drop down on each sheet that when changed will change the same single cell on the Summary worksheet, so I don't need to go back to the Summary sheet every time I want to switch visible scenarios.
This is a simple process if I'm using macros and would be the solution I'd normally jump straight to. But this needs to be done without macros and this is where I'm now struggling.
Does anyone know if this is possible (without macros) and point me in the right direction?
Josh
You can insert combo box (Developer Tab > Insert > Form Controls > Combo Box) on each sheet. Mention linked cell as a cell of the summary sheet (Absolute reference with sheet name). That cell will give you index of the item selected in the drop down list. Then you can insert index formula in the cell you want to change every time to get value of the drop down list. Once you insert it on one sheet you can copy it to other sheets. No macros required.

Password protect Excel sheet but allow editing

I have built an excel spreadsheet that pulls data from another sheet by various Vlookup. E.g if you type in a number in one cell it pulls back the corresponding Name, job, title etc from the data in the other sheet.
As this is to be used by others I wanted to Hide the formula so it’s not visible in the formula bar.
I unlocked all the cells, selected the cells with formula I wanted to hide, locked and hid those cells then protected the sheet. When testing I can enter data in the unlocked field and get results but I also have a reset macro button. When I reset the fields I am unable to enter data as the sheet is protected. Any help on what I might be doing wrong?

How do i create a Power Query custom column AND insert an excel formula into each cell of the final table?

I want that when the table is created there will be a fully functioning excel formula. If I try with "... each "=[#[Prog.]]" there will insert only the text not the formula.
P.S.: I'm new to this so, excuse me if this is basic.
From what I understand, you can create Excel formulas in Power Query and pass those to your Excel worksheet but the worksheet won't automatically recalculate. This earlier post addressed the same thing.
I tried this out by creating a table with two columns: "Column1" and "Column2", with the numbers 1 & 2 in each, respectively. Then, I loaded the table into Power Query and created a new column, "Custom", with the formula, "=" & Text.From([Column1]) & "+" & Text.From([Column2]). (To be clear, the = here is not the = that is already populated when the new column dialog box pops up, it's additional.) Anyhow, I got this table from that formula:
Then, when I clicked "Close and Load," my Excel worksheet was loaded with this:
Notice it looks just like text, but in the formula bar, it looks like this:
Notice there isn't a ' before the =, so it's a formula. If it were just text, it would be '=1+2 instead of =1+2.
Since the cell doesn't automatically recalculate, I had to click the cell I wanted to update, and then click in the formula bar and then press enter. That gave me this:
I tried to use F9 to manually recalculate, but it did not work.
Also... Every time I refreshed my query, my worksheet was set back to just the text-looking formula (i.e., =1+2) and I had to re-recalculate manually. That would be a real pain to have to do that for a lot of cells each time you refresh your query.
#Umut K posted a VBA-based workaround to trigger refresh all in the earlier post, but I think what you are asking to do might be more trouble than you're looking for.
The above answers are correct that the formulas do not automatically recalculate, even though they are in the cell correctly. A workaround/trick that I found was to use -Find/Replace to trigger a recalculate on every cell in one step. Go to one of the cells with the formula; to copy the entire formula. to open the Find/Replace dialog. in both the Find What and Replace With boxes in the dialog. Click on Replace All. All the cells except the one you are in will recalculate. Then, exit the cell you are in, and it will also recalculate.
It seems stupid, but it works.

Paste values disabled in Excel when recording a macro

I started to record a macro, added a name and inserted the formula =NOW( ) in a cell.
After selecting and copying this cell, I want to convert the formula to its value by "Paste Values" in Home->Clipboard->Paste menu.
The Paste Values submenu command is disabled, and the Record Macro button is disabled. This results in being unable to stop recording the macro.
How can this be solved?
I wasn't able to replicate this behaviour so not sure why you are unable to stop recording your macro but ...
I presume you are trying to have the cell contents contain the time / date at a fixed point and not change every time you open the spreadsheet or recalculate? If so, a line such as:
activesheet.range("A1").value = now()
This removes the need to faff about with copying and pasting values.
HTH

Resources