Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating a simple formula for a range of cells Christopher[_2_] Excel Discussion (Misc queries) 3 February 21st 07 08:04 AM
Creating a very simple spreadsheet for my diet Tim Excel Discussion (Misc queries) 3 October 18th 06 12:43 PM
question about creating a simple drop down list [email protected] Excel Worksheet Functions 4 March 18th 06 06:03 AM
I'm creating a simple spread sheet Jan in Excel Excel Discussion (Misc queries) 2 January 2nd 06 07:48 PM
PLEASE HELP!? Creating a simple database with excel, minor setback Pre-construction Manager & Excel !? Excel Worksheet Functions 1 November 30th 04 08:59 PM


All times are GMT +1. The time now is 06:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"