ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to enter a value, tab to next cell in the row, enter ... (https://www.excelbanter.com/excel-programming/430952-re-macro-enter-value-tab-next-cell-row-enter.html)

Jacob Skaria

Macro to enter a value, tab to next cell in the row, enter ...
 

Try the below. You dont need to select..You can use the Offset function to
refer the cell down by incrementing the row number..

Sub A_FILLIN()
ActiveCell = "A"
ActiveCell.Offset(1) = "May"
ActiveCell.Offset(2) = "Joe"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"FirstVette52" wrote:

I recorded a macro to enter data in a cell, tab to the next cell and enter
data, tab to next cell, and enter data.

The problem is it runs in the cell it was recorded in, not whatever cell is
currently active. How do I modify the code to start in whatever cell is
currently active and then tab to whatever cell is to the right of that cell
and enter data... etc.

Here's the code:

Sub A_FILLIN()
'
' A_FILLIN Macro
' Fill-in the row with A May Joe, and then
' drop down to the next row/cell beneath A
'
' Keyboard Shortcut: Ctrl+Shift+A
'
ActiveCell.FormulaR1C1 = "A"
Range("B1").Select
ActiveCell.FormulaR1C1 = "May"
Range("C1").Select
ActiveCell.FormulaR1C1 = "Joe"
Range("D1").Select
End Sub

Thanks for your help
--
FirstVette52



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com