Jump to content
Macro Express Forums

move mouse to cell in Excell


Recommended Posts

I've written a macro which needs a few bugs sorted out:

 

The macro is supposed to copy the value of a specific cell (From an active, maximized Excel Worksheet), then paste that value into program B. Then after program B does its thing, the macro repeats, but now drops down one cell. (there are over 1,500 rows).

 

At the moment I'm using mouse positions relative to the open (active) window, but ME is having difficulty finding the cell.

 

Is there a method to tell ME to go to a specific cell in Excel? Once the first cell is chosen, I think the prob is solved because the next time ME just hits the down arrow once, and we're at the next row.

 

Thanks!

Link to comment
Share on other sites

  • 3 weeks later...

Locate your starting cell with a VBA macro in Excell.

 

Pick a cell one above your first data cell in the column. Color it blue (thank me later, it's for debugging).

 

 

Turn on the Excell VBA toolbar (view/tool bars/visual basic). Press the round Record Macro button. A dialog pops up. Use the default macro name and description unless you are going to be making a lot of them. leave the default selection to save the macro in the worksheet. assign a hotkey (you may not use c). Put your cursor in the box to ad a letter, hold down the shift key (another thank me later) and hit a key.

 

Now go to the blue cell with the mouse and click it.

 

Then go to the Visual Basic tool bar and click the square to stop the recording. The VBA MAcro is not recording the mouse moves or keystrokes, it's recording commands (clicks and what you click on, what a keystroke does, etc. open the VBA editor to see the code)

 

Done. Try out the hot key.

 

In your ME macro, call the hot key with the text type command.

 

If you are going to be adding or subtracting columns you can use a slightly different routine. Name the blue cell (ctrl+F3) then us the visual basic macro to hit F5 (brings up the name selector dialog), then the mouse to select a name and hit OK. Again, assigned to a hot key for ME to use.

 

Once located on the blue square, use an arrow down loop with a counter that increments by 1 to go to the next cell down . It starts at the top every time. Watch your speed.

 

 

 

 

 

 

I've written a macro which needs a few bugs sorted out:

 

The macro is supposed to copy the value of a specific cell (From an active, maximized Excel Worksheet), then paste that value into program B. Then after program B does its thing, the macro repeats, but now drops down one cell. (there are over 1,500 rows).

 

At the moment I'm using mouse positions relative to the open (active) window, but ME is having difficulty finding the cell.

 

Is there a method to tell ME to go to a specific cell in Excel? Once the first cell is chosen, I think the prob is solved because the next time ME just hits the down arrow once, and we're at the next row.

 

Thanks!

Link to comment
Share on other sites

  • 2 months later...

If you need to process a column of cells, "Text Type <ARROW DOWN>" should move down to the next cell. You may need to use <ESC><ARROW DOWN> instead.

 

If there is an advantage to specifying a cell, use "Text Type <F5>"

 

 

Alans idea works fine in Excel, if you also add a new column that contains the formula =ROW. You then have the possibility to use the row number in a variable. Copy the number of the row e.g to N1. Use Alans "Text type <F5>" and then fit "TEXT TYPE:Sheet1!$A$%N1%" into referens. In other words jump to a specific column in a specific sheet.

 

Regards.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...