How to paste predefined texts? - excel

I use few predefined strings a lot during the creation of data in MS Excel.
Is there a way I can create a drop down option on right click that says "Paste As..." and then select one of the texts I have predefined? Like an add-in.
Or is there some in built Paste option within Excel itself? That would save up loads of time for me.

In Excel Options (via the Office Button) under Proofing you may have an AutoCorrect Options... button where you can specify Replace: and With:. So you might choose something like qq1 (as unlikely to be required as such) to be replaced with whatever text you prefer to replace qq1.

Related

Find a module from VBA editor in Excel 2010

I am updating an Excel Spreadsheet from Office XP .xls to Excel 2010 .xlsm. When I did this, some of the function names were renamed or are not able to be accessed any more.
These are hundreds of functions on hundreds of module pages in my VBA editor. Is there some way to find the function I am looking for without opening each module and searching through it? It seems to me that find only works inside of each module page.
I still have the working xls and if I could just, for example, control click the function name and it would open up the module that contained that function, I would know where it was. Is something like that possible? Or is there a function finder?
Thanks!
(Everything below is related to the VB Editor)
Right-click on the function name, then chose "Definition" in the context menu.
For error checking, go to VBE menu "Debug" → "Compile <module-name>".
For structured overview of all the available methods, properties, events, objects, types, press [F2].
(For UDFs found in formulas of worksheets)
Keep the spreadsheet and the VBE open;
Copy the name of the UDF from the formula;
Paste it in the Object Browser [F2] in the search box; double click on the found UDF will open the containing module.
Unfortunately, I don't know a more straightforward way, but is better than manual search I think. :-)

Creating new xlm macros in excel 2007

Is it still possible to create (note create: not run) xlm macros in Excel 2007? I have an interest in historical languages (yes, I know xlm macros aren't going that far back in the grand scheme of things) and want to muck around with them.
I've searched the web and there's a million hits for how to enable support for legacy xlm macros, and that's all well and good. But I'm looking for info on how to create new ones. Would someone be able to point me in the right direction?
To create a macro sheet in XL2007 - Right-click a sheet tab, choose Insert and then Excel 4 Macro sheet.
It may or may not need a macro sheet. But the actual question was how to create the macro itself. It must be declared as a macro. In XL 14, which still supports XL4 macros (Excel macros, as opposed to VBA macros (Visual Basic macros)), you write a series of XLM commands in a column. It will be executed top down. To declare it, you select the top cell of that range, then under the 'insert' menu, under the 'name' submenu, pick 'define'. Give it a suitable name and hit 'add'. Then select it within the same dialog, and radio buttons will appear below. They will offer 'command', 'function', or 'none'. Choose command or function, as appropriate.

Reference Excel cells in Word

Does anyone know of a pre-packaged solution for referencing Excel cells directly in a Word document?
For example,
{[TestExcel]Tab1!A1}
Dear Mr. {[TestExcel]Tab1!A2},
Our systems have alerted us that your account {TestExcel]Tab1!AccountNumber} is overdue. Please remit payment of {TestExcel]Tab1!PaymentDue} immediately.
This example uses a hypothetical { } syntax, where the contents are standard Excel formula.
Every solution I've seen uses custom VBA to accomplish this. It seems like an extremely common need for which there should be some good 3rd party software available that lets non-technical users accomplish this task.
As indicated in the example above both named ranges and standard cell references would need to be supported.
Yes.
Step 1: Copy the excel cell.
Step 2: Go to your word document where you want to paste the reference.
Step 3: Right click
Step 4: Under paste options, select "link with source formatting" or "link and merge formatting".
I tried #Green Demon's method, but the two Paste Options listed were not present for me (Office 2013). I only had Keep Source Formatting, Merge Formatting, and Keep Text Only. However, I poked around and found the Paste Special, which was hidden on the Ribbon
The instructions are as follows:
Copy the Excel range.
Go to your Word document, and left click where you want to paste the Excel range.
Click on Paste Special from the Ribbon as shown below, or type Ctrl+Alt+V.
Click on the Paste link radio button.
Click on Microsoft Excel Worksheet Object. The Paste Special dialog box should look something like this:
Click OK.
The range should now be pasted in your document, and if you save, close, and re-open the Word document, you will be prompted about whether or not you want to "update this document with the data from the linked files," which works the same way as it does if you're doing Excel-to-Excel linking.
This feature is fantastic, and I'm so happy to have found it today. However, in my brief experience using it, having these Word-to-Excel links dramatically increases the amount of time it takes to open your Word document, even before it prompts you about updating. After that, the act of updating the Excel links takes much longer than it would if you were doing the same linking Excel-to-Excel. All of my work is done on network-share files, so YMMV.
While Will's solution indeed links from the Cell objet, the content is inserted as a picture.
In the same dialog, selecting "Unformatted Unicode Text" instead will link and insert only the cell's content, which is desirable if you apply custom formatting on your text.
Unfortunately, this action only works for a single cell. Copying multiple cells will result in a text block with individual cell content seperated by tabs or line skip, with the entire block considered linked and entire. The solution is to link individual cells using this method.
This can become tedious if you plan on linking large portions of table from Excel, as for every cell the dialog must be invoked. It can be sped up by using hotkeys, but the sequence gets tedious:
alt,h,v,s, then alt+l, tab, ↓, and finally Enter
Obviously this is not practial for large numbers of cells. A AutoHotkey script can help but it third party grafted solution, on par with using VBA scripts.
alt+h+v+l works too. If you're building big documents clicking the ribbon every time gets murderous after a while.
As this is still a problem but the other answers do not take into account the latest development in word, there is a new solution, editing Green Demons answer:
Step 1: Copy the excel cell.
Step 2: Go to your word document where you want to paste the reference.
Step 3: go to the "home" tab
Step 4: Under paste options, go to "Paste Special", click on "paste link", click on "Unformatted Text".
This solves the issue others were having with the new lines that you would otherwise have with just Green Demons' solution.
Hope this still helps others.

How do I add a form in an Excel sheet?

How can I add an input form in an Excel sheet. I want to insert values into an Excel cell using the form.
ALT+F11 starts the VBA editor in Excel. In there you can create UserForms (Insert | UserForm) which you can bind into their own modules or attach to worksheets.
I suggest you look at the Excel help or MSDN for details of what you can do with UserForms. There are also a lot of VBA tutorials on the web for exactly this sort of thing. Google is your friend.
HTH
There is a quick and dirty method of creating simple forms in Excel. No VBA is required.
First, create a table with the basic format that you want.
E.g.
A B C
1 Name Age Favourite Animal
2 Jane 11 Horse
Select the range, and then select Data | Form. (This is in Excel 2003.)
It will open up a simple form that allows navigation, creation, deletion, and searching.
#Oddthinking,
Cool trick. Never knew it existed. I had to do a little looking, but you can do it in Excel 2007 as well.
Click the Office button, select Excel Options, go to the Customize tab
Select 'Commands Not in the Ribbon' from the 'Choose commands from' drop down
Find 'Form' in the list and click Add, then click OK
At this point, the Forms command will show up on the Quick Access toolbar, next to the Save and Undo/Redo icons.
You have to activate the form toolbar.
Of course, IIRC, the form must be handled by VBA code.

How can I permanently prevent Excel from setting all new documents to R1C1 mode?

Every time I create a new excel sheet, I have to go in and change it's cell reference mode to the familiar A1, B1, etc. I can't seem to find a way to permanently set it to A1 style.
Is there a macro I can write or a way to use templates or something, so that I don't have to keep changing the R1C1 setting?
In Office 2007, Click the Office button and click Excel Options which you will find at the end near Exit Excel.
Go to Formulas tab and under Working with formulas, Check or uncheck R1C1 reference style to use it or to change it to A1 reference style.
(source: lytebyte.com)
If it doesn't stick you have some problem with a personal.xls or the default template or something I guess...
EDIT:
Try this first:
Close all spreadsheets down. Assuming you have created one previously, unhide your Personal.xls workbook (Window>Unhide; In Excel 2007 and newer,View,Unhide) and then uncheck the R1C1 reference style. Save your Personal.xls, rehide & close down Excel (clicking Yes to save changes to Personal.xls). With any luck you should now have your default A1 style back. You will have to repeat the above with any other workbooks in your XLSTART directory and/or the start up location in Tools>Options>General tab.
Then this:
Help > Detect & Repair.
If no good, try http://support.microsoft.com/kb/291288
Last resort:
Use Start > Run excel /regserver
NOTE the space after "excel"
You could create a toolbar button that allows you to change the worksheet to A1 type referencing. This Excel macro will do the job:
Sub useA1references ()
Application.ReferenceStyle = xlA1
End Sub
If that works, you can set the macro to run whenever you open Excel or create a new workbook.
In my case,
only this link worked (i paste the answer here, as it might go away):
Press [Alt]+[F11] to launch the VBE.
If the Immediate window isn't visible, press [Ctrl]+g.
In the Immediate window, type ? application.StartupPath and press Enter. VBA will display the path to XLStart.
Make a note of the response. Mine is
C:\Users\Bernard\AppData\Roaming\Microsoft\Excel\XLSTART
Open a new workbook
Open Excel > File > Options > Formulas > Uncheck ‘ R1C1 reference
style’ under Working with style > click on ‘OK’.
Click on File > Save as > Browse to the XLSTART folder and give the
file the name Book.xltx. Press OK
The biggest problem of the R1C1 reference style setting is that Excel saves it in templates and/or files. This behavior is unpredictable and differs from version to version. Due to this, sometimes, this setting gets spread like a worm from a single file.
To address the issue, I've written a small Add-In that silently forces A1 reference style for all existing and new workbooks. It contains also a macro requested and is tested on Office 2016 and 2019.
It's also worth mentioning that Office ADMX templates have a built-in policy to control R1C1 defaults (User Policies/Administrative Templates/Microsoft Excel 2016/Excel Options/Formulas/R1C1 reference style). It doesn't affect existing files and templates at all, though.
I suppose the template has been saved with the R1C1 option. Maybe you can open it, change the option and overwrite the original template?
As In.Spite mentioned, it's probably a default template issue. If you overwrite the default with one that has the R1C1 reference box unchecked, it should remember the setting.
Here's as KB describing where you can find the default template:
http://support.microsoft.com/kb/924460
Locate the template, open it, untick the `R1C1 reference box, and overwrite the old template.
Not directly applicable, but...
For some of my purposes R1C1 notation is very useful, so I made a macro that toggles it and attached it to a toolbar button:
With Application
If .ReferenceStyle = xlA1 Then
.ReferenceStyle = xlR1C1
Else
.ReferenceStyle = xlA1
End If
End With ' Application
I have written an add-in to address this (and related) issues w.r.t. R1C1 addressing. The add-in can be configured to save all workbooks in a specific format (either R1C1 or A1 mode) and also to force your Excel into the desired addressing mode whenever you open a workbook. It also provides a button on the ribbon to switch between addressing modes. It's available from: http://rath.ca/Misc/VBA/Excel/RC_A1_Toggle_v2.zip

Resources