Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating what should be a simple macro
I want to create a macro that will start in the current cell, give a carriage
return to go to the cell below, give a F2 keystroke, then a Home keystroke and end. I know this is very basic, but I can't seem to get it to work. Any assistance will be greatly appreciated. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating what should be a simple macro
Sub dwight()
Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{HOME}" End Sub You may need to back up a row. -- Gary''s Student - gsnu200715 "Dwight" wrote: I want to create a macro that will start in the current cell, give a carriage return to go to the cell below, give a F2 keystroke, then a Home keystroke and end. I know this is very basic, but I can't seem to get it to work. Any assistance will be greatly appreciated. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating what should be a simple macro
Thanks, that's exactly what I needed.
"Gary''s Student" wrote: Sub dwight() Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{HOME}" End Sub You may need to back up a row. -- Gary''s Student - gsnu200715 "Dwight" wrote: I want to create a macro that will start in the current cell, give a carriage return to go to the cell below, give a F2 keystroke, then a Home keystroke and end. I know this is very basic, but I can't seem to get it to work. Any assistance will be greatly appreciated. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating what should be a simple macro
You are very welcome. If you ever have trouble using SendKeys to change a
cell, include the DoEvents prior to going to another cell. -- Gary''s Student - gsnu200715 "Dwight" wrote: Thanks, that's exactly what I needed. "Gary''s Student" wrote: Sub dwight() Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{HOME}" End Sub You may need to back up a row. -- Gary''s Student - gsnu200715 "Dwight" wrote: I want to create a macro that will start in the current cell, give a carriage return to go to the cell below, give a F2 keystroke, then a Home keystroke and end. I know this is very basic, but I can't seem to get it to work. Any assistance will be greatly appreciated. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating what should be a simple macro
I put that in and had one too many returns, so I took one out.
After it does the line down, the F2 and the Home, I need to enter one character at the front of the cell then turn it off. It works great until I want it to turn off then it deletes what I typed and sits at the front of that cell blinking. I need it to either stop after my character I imput or take the first character from the cell to it's left and add it on the front for me in a loop. Now what? "Gary''s Student" wrote: Sub dwight() Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{HOME}" End Sub You may need to back up a row. -- Gary''s Student - gsnu200715 "Dwight" wrote: I want to create a macro that will start in the current cell, give a carriage return to go to the cell below, give a F2 keystroke, then a Home keystroke and end. I know this is very basic, but I can't seem to get it to work. Any assistance will be greatly appreciated. |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating what should be a simple macro
Let's start with the HOME. Say we want to enter the character Z in that
first column Sub dwight() Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{HOME}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "Z" Application.SendKeys "{ENTER}" DoEvents End Sub Here's what's happening: 1. the HOME gets us back to column A 2. the DoEvents make sure Excel is ready to receive data 3. the F2 put the cell in edit mode 4. the "Z" dumps Z into the cell 5. the ENTER completes the entry 6. the final DoEvents makes sure that Excel has processed steps 3,4,5 That's why the DoEvents is so important: Sendkeys is like pitching softballs. DoEvents allows the catcher to catch the balls. -- Gary''s Student - gsnu200715 "Dwight" wrote: I put that in and had one too many returns, so I took one out. After it does the line down, the F2 and the Home, I need to enter one character at the front of the cell then turn it off. It works great until I want it to turn off then it deletes what I typed and sits at the front of that cell blinking. I need it to either stop after my character I imput or take the first character from the cell to it's left and add it on the front for me in a loop. Now what? "Gary''s Student" wrote: Sub dwight() Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{HOME}" End Sub You may need to back up a row. -- Gary''s Student - gsnu200715 "Dwight" wrote: I want to create a macro that will start in the current cell, give a carriage return to go to the cell below, give a F2 keystroke, then a Home keystroke and end. I know this is very basic, but I can't seem to get it to work. Any assistance will be greatly appreciated. |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Creating what should be a simple macro
Thanks, that makes sense, and I'll see what I can do.
"Gary''s Student" wrote: Let's start with the HOME. Say we want to enter the character Z in that first column Sub dwight() Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{HOME}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "Z" Application.SendKeys "{ENTER}" DoEvents End Sub Here's what's happening: 1. the HOME gets us back to column A 2. the DoEvents make sure Excel is ready to receive data 3. the F2 put the cell in edit mode 4. the "Z" dumps Z into the cell 5. the ENTER completes the entry 6. the final DoEvents makes sure that Excel has processed steps 3,4,5 That's why the DoEvents is so important: Sendkeys is like pitching softballs. DoEvents allows the catcher to catch the balls. -- Gary''s Student - gsnu200715 "Dwight" wrote: I put that in and had one too many returns, so I took one out. After it does the line down, the F2 and the Home, I need to enter one character at the front of the cell then turn it off. It works great until I want it to turn off then it deletes what I typed and sits at the front of that cell blinking. I need it to either stop after my character I imput or take the first character from the cell to it's left and add it on the front for me in a loop. Now what? "Gary''s Student" wrote: Sub dwight() Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{F2}" Application.SendKeys "{ENTER}" DoEvents Application.SendKeys "{HOME}" End Sub You may need to back up a row. -- Gary''s Student - gsnu200715 "Dwight" wrote: I want to create a macro that will start in the current cell, give a carriage return to go to the cell below, give a F2 keystroke, then a Home keystroke and end. I know this is very basic, but I can't seem to get it to work. Any assistance will be greatly appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
creating a simple formula for a range of cells | Excel Discussion (Misc queries) | |||
Creating a very simple spreadsheet for my diet | Excel Discussion (Misc queries) | |||
question about creating a simple drop down list | Excel Worksheet Functions | |||
I'm creating a simple spread sheet | Excel Discussion (Misc queries) | |||
PLEASE HELP!? Creating a simple database with excel, minor setback | Excel Worksheet Functions |