I have a macro/Sub that I wish to run everytime the enter key is pressed. Does anyone know the correct syntax?
Excel on Enter Macro
How to run a macro when certain cells change in Excel
Right-click the Sheet1 tab and then click View Code.
The module sheet behind Sheet1 is opened.
Type the following code into the module sheet:
Private Sub Worksheet_Change(ByVal Target As Range) Dim KeyCells As Range. ...
Click Close and Return to Microsoft Excel on the File menu.
Related
I'm looking into creating something like a macro for localization of strings. Until now, I have only find that (maybe) a custom Code Action might be what I need.
After I select some code, let's call it selection, I want the to:
Ask me for a name
Write to another file: name = selection
Write in current file: (some_fixed_code)name(some_other_fixed_code)
Is there any way to create that macro, for it lo launch with a left click option or a keyboard shortcut?
Thanks in advance!
I have around 300-400 sheets in a Libreoffice Calc file.
I have tried everything and I can't seem to go to a particular sheet by its name, that is the sheet is named: XYZ and when I try to find it using XYZ there are no results.
How do I go to a sheet by its name?
Go to Tools -> Macros -> Organize Macros -> LibreOffice Basic and add this code.
Sub gotoSheet
sName = InputBox("Which sheet?")
oSheet = ThisComponent.getSheets().getByName(sName)
ThisComponent.CurrentController.setActiveSheet(oSheet)
End Sub
Then go to Tools -> Customize and attach the macro to a toolbar button or hotkey.
Other options for going to a particular sheet more easily, such as using the Navigator list or creating hyperlinks, are described at:
https://ask.libreoffice.org/en/question/10650/jumping-sheet-tabs/
https://ask.libreoffice.org/en/question/167878/where-is-the-goto-function-within-calc/
No need to create a macro. Just use the keyboard shortcut Ctrl+Shift+F5 to jump to the name box, type the (whole) sheet name and press enter.
i'm writing a script that needs to copy and paste text from an entry in a dialogue box
set query to text returned of (display dialog "Enter Text" default answer "" buttons {"Input", "Cancel"} default button 1)
query
tell application "System Events"
keystroke "c" using command down
keystroke "v" using command down
end tell
when i run this script it copies and pastes "set query to text..."
how can I copy the query that I entered ? i'm going to paste the text somewhere else later but I need to figure out how to actually copy the text. I was using keystroke query but that was taking a long time when the strings were long
Use set the clipboard:
display dialog "" default answer ""
set the clipboard to text returned of result
If others get here searching for how to for example copy a long error message from a dialog shown by OS X, you can use Accessibility Inspector, which is in /Applications/Xcode.app/Contents/Applications/.
I am new to python.. I am trying to create a macro. When selected a word and press f3 filedialog will come and ill select a folder,ill get the occurance of that word in all files in tat folder displayed in the pane. The problem now is I couldn't return a value from macro editor to this pane.
Currently I am using this code
code_task = get_active_task()
python_pane = code_task.python_pane
python_pane.execute_command(u'print "searchstring"\n')
(consider searchstring contains the data)
When I try to execute it is telling tat undefined variable searchstring. Help me how to send the data from macro editor to the pane.
I have two Excel picture objects linked to different forms, each with a text box and OK/Cancel buttons. In one form, the text cursor is in the textbox when clicking the object which is what I want:
but in another it selects the OK command button rather than have the text cursor in the textbox:
I've gone through the form and textbox/command button properties and see nothing about selection, and the 'correct' macro properties appear to be the same as the 'incorrect' one.
What do I do to change the form such that when it's opened the text cursor goes to the textbox instead of the command button being selected?
Quite easy solution is to change TabIndex Property to 0.
So, 1) go to VBA Editor, 2) select your TextBox in your UserForm and 3) change TabIndex Property in Property window as presented below.
Add an event to the form so that when it is initialized it selects the correct texbox.
Private Sub UserForm_Initialize()
TextBox2.SetFocus
End Sub
Before the form is displayed, you can do soemthing like:
TextBox1.SetFocus
Obviously, replace "TextBox1" with whatever the name of your textbox object is.
This should go in whatever event or macro causes the form to .Show, immediately before the .Show statement.