Thomo4321

New Member
Joined
Apr 18, 2019
Messages
44
Office Version
  1. 2016
Platform
  1. Windows
Afternoon All,

I have the following Macro for the sample Table below.

I would like the Macro to loop until it reaches the end of the table, at the moment i have the shortcut entered at the end but this requires me to be infront of the computer at all times to end the macro by pressing ESC.

Any help is much appreciated

ABCDEFG
PARTMAKEMINMAX2M1MREORDER
ABCDSE15674

<tbody>
</tbody>


Code:
Selection.Copy
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "%{Tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "^v"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "{tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "%{tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "{Right}{Right}{Right}{Right}"
Application.Wait (Now() + TimeValue("00:00:01"))
Selection.Copy
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "%tab"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "^v"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "{Tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "%{tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "{right}"
Application.Wait (Now() + TimeValue("00:00:01"))
Selection.Copy
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "%{Tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "^v"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "{Tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "%{Tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "{right}"
Application.Wait (Now() + TimeValue("00:00:01"))
Selection.Copy
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "%{Tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "^v"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "%{Tab}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "{down}{left}{left}{left}{left}{left}{left}"
Application.Wait (Now() + TimeValue("00:00:01"))
Application.SendKeys "^m"










End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Can you just select the cell you want? Or do you have to tab to it?

You could do something like:


Code:
    dim lRow as integer, dim lCol as integer
    'Find the last non-blank cell in column A(1)
    lRow = Cells(Rows.Count, 1).End(xlUp).Row
    
    'Find the last non-blank cell in row 1
    lCol = Cells(1, Columns.Count).End(xlToLeft).Column

    'Select the rightmost column and bottommost row
    cells(lRow, lCol).select
 
Last edited:
Upvote 0
Thanks BlueAure,

With every second %{Tab} It can be anything, but after the first %{Tab} i need to keep it as is as my program that im trying to enter info in doesnt like anything else, also some times it lags hence all the wait times in my original macro.

The table i suppied is only a snippet, my spreadsheet has about 84 columns. but the snippet is all the info i require for this macro.

Thanks
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,949
Members
448,534
Latest member
benefuexx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top