The way I have been using excel to transform data calculated via formulas into static values was to select each cell, press F2 to edit it and then press F9to replace the content of that cell with the result of the formula in it.
I was wondering if there is a convenient way to do this process to a group of selected cells. It would come in handy if I wanted to do this to hundreds of cells at a time.
Could anybody please tell me if that is possible? And if so, how?
If a VBA based solution is viable, then this short routine should suffice.
sub Values_Only()
with selection
.value = .value
end with
end sub
Just select a group of cells and tap Alt+F8 then Run the macro. Optionally, use Options in the Macros dialog to set a hot key combination.
You may also find the Quick Access Toolbar (aka QAT) of use to assign the Paste Values command to a hotkey. Mine is set to Alt+2. With any group of cells selected, Ctrl+C then Alt+2 is sufficient to revert formulas to their returned values. See this for more information.
Highlight all of the desired cells. Copy them. Then right click the highlighted area and select the 123 paste option.
Related
I'm wanting to have a an excel spreadsheet automatically fill in a dropdown selection based on a previous dropdown.
Basically i have a spreadsheet that allows me to pick colours of items from basic dropdown lists each row has its own dropdown. Often the colours are the same so would like it to automatically fill in the next rows colour the same as the previous lines for me?
anyone have any ideas? Can't seem to find much on only filling out the dropdown? Also is there a method to fill out all dropdowns simultaniously?
Thanks
There are two approaches to this depending on what you mean by 'drop-down'.
If you are using a 'form control' drop-down then you have the option under right-click>Format Control... to specify a cell whose value will be set when you change the drop-down selection. You can then use this value to affect other areas of your spreadsheet.
If your drop-down is done using the 'Data Validation' then it will only affect the cell you have put it in. In this case you will have to turn to VBA.
For this you would use the Worksheet_Change event and an If statement checking that the Target is the drop-down cell, then you can code the filling in of your other dropdowns. Check out this microsoft guide for triggering VBA from cell changes.
I do have a document with some formulas retrieving data from other tables. Some of the users were overwriting these formulas with more accurate data. I would like to delete now all the data retrieved from the formulas (so basically I would like to delete the formulas) and only keep the manual entered data.
How could this be done? I just know the other way around :)
Select the whole range, Home / Find and Select / Go To Special, check Formulas, OK, hit Del button on keyboard.
If you need the VBA code, this is it:
Selection.SpecialCells(xlCellTypeFormulas, 23).Select
Of course you can omit the Select thing, and do whatever you want with it, e.g. clear it:
Selection.SpecialCells(xlCellTypeFormulas, 23).Clear
Or on the whole worksheet:
Cells.SpecialCells(xlCellTypeFormulas, 23).Clear
I am working on the following sheet, called Raw_Data:
In a new sheet, I want to copy the registration_date column by reference. This means that if I change the registration_date on the Raw_Data, the changed value should be reflected in the new sheet.
To implement this, I have entered the following =Raw_Data!C2. So far it works fine as you can see below:
But the problem is that when I double click on the little green square here, it doesn't automatically populate the entire column.
I don't want to manually drag-and-drop because there are several thousand rows. Does anyone know how I could automatically populate the column by reference?
While there are some automation things you could do, I think a lot of that would be overkill for what could be just an input issue with how you are choosing to copy in Excel.
If you find that you need to copy a large block of data, rather than dragging the corner of your cell like that, try one of these alternate methods:
While selected on the cell, press CNTRL + C. Then in the 'Name Box' (where it shows the address of the cell you are on), type in the cell where you want to go (A17000); then press SHIFT + ENTER. This will jump you to that cell, and will highlight all cells inbetween where you were and where you are going. Then press CNTRL + V.
Another method of moving around a large data block in Excel is to hold CNTRL and press an arrow key. This will move you as far down the data block as possible. Note that this will not work on a blank sheet, as there is no data and therefore Excel doesn't know when to stop.
Again - some automation would be possible here, but moving around an Excel worksheet is something you will be doing too frequently in too many different ways to want to automate what might be 5 keystrokes once a week.
In excel the "double click to fill" feature is a heuristic based feature that fills the cells that appear to be relevant with the selected formula (+ reference corrections).
In your case there is no hint the heuristic can use to tell what to fill so nothing is being done.
Regarding dragging "several thousand rows", that's not a real problem. If you only do it once, there no reason to even trying anything "smart" or complicated.
You can also copy the source cell, select all the cells you want to fill and then paste. You can select cells in any way you like, not just dragging.
You could instead of all the dragging/copying/filling approach simply copy directly from the source, and paste by reference.
As a last resort, you can always go for a VBA solution to do that for you.
Using the livecode datagrid, does copy and paste from one cell to another possible? Something like the spreadsheet capability.
Currently, we need to double click the cell and copy its text from one cell to another non-empty cell.
Update: This is now working. I got below code from here
on commandKeyDown k
switch k
case "c"
copy
break
case "v"
paste
break
default
pass commandKeyDown
end switch
end commandKeyDown
Yes, if cell editing is enabled, you will find that a DataGrid acts very much like a spreadsheet. Just pretend you are in Excel, and use the DataGrid the same way. So if you copy some portion of data in a "cell", you may set the insertion point at any point in any other "cell". Then just paste as usual.
This is all doable under script control, where you can extract the contents of the DataGrid via the dgText or the dgData, manipulate that data in the clear or as an array, and then reset that property with the new information.
If I manually enter a formula into a column in an Excel table (i.e. ListObject), AutoCorrect applies this formula to the whole column.
Is there any way to control the this behavior via VBA, i.e. can I somehow modify/delete/add this formula?
I know I can simply change the formula of the ListObject.ListColumns(1).DataBodyRange object - but this will overwrite any manually values entered before - while changing the formula in the UI will leave this untouched...
Thanks to Doug's and bonCodigos comments/answers, I found the simple answer:
ListObject.ListColumns("Column name").DataBodyRange.FormulaR1C1 = "new formula"
This will overwrite any manual value (just as the normal behavior with AutoCorrect).
Best would be if you could show us a screen shot of your sheet. Based on that we would have articulated the answer.
Here is with the general assumption. That you have one list object to dump some data to a column and rest of the cells in that column are manually interacted.
You could try the following manually first and see if it works for you. Still the manual one is being overtaken by the code level, then you do this in code level. :)
The main action here is to Stop automatic corrections
Go To -> Tools menu -> Click AutoCorrect Options ->
In the AutoCorrect Tab ->
1- To prevent ALL automatic corrections
Clear the check box for Replace Text as you type
2- To prevent SPECIFIC corrections
Clear the corresponding check box for the option. I believe you are more interested in the latter - specific data range that you just dump via a listobject.
Now here is the code for disabling this feature at code level.
When working with Excel Tables (ListObjects) there are two AutoCorrect options to consider: You can read about those two in details.
* Apply new rows and columns in table
(VBA AutoCorrect.AutoExpandListRange Property)
* Fill formulas in tables to create calculated columns
(VBA AutoCorrect.AutoFillFormulasInLists Property)
Code you may want to use at the top of our listobject is,
Application.AutoCorrect.AutoFillFormulasInLists = False
And totally agree that it would be so much more useful if Application.AutoCorrect. AutoFillFormulasInLists controlled on a table by table basis at the ListObject level. So here is a workaround.
So one way is to clear your table data each time. And when you clear data you can make sure for TABLE TO FORGET forumulae and formatting. So it will clear the contents of the data body range before deleting table contents.
Sub forgetMe()
With Sheet1.ListObjects("myTable")
If Not .DataBodyRange Is Nothing Then
.DataBodyRange.ClearContents
.DataBodyRange.Delete
End If
End With
End Sub
When you input the data, start with auto stuff off.