Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Macro to enter a value, tab to next cell in the row, enter ...


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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Macro to enter a value, tab to next cell in the row, enter ...


That puts the next value in a new row, but the next value needs to go in a
new column on the same row. Once all the values have been entered then it
needs to go to a new row.

Thanks for your help
--
FirstVette52


"Jacob Skaria" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Macro to enter a value, tab to next cell in the row, enter ...

Sub A_FILLIN()
ActiveCell = "A"
ActiveCell.Offset(0, 1) = "May"
ActiveCell.Offset(0, 2) = "Joe"
ActiveCell.Offset(1, 0) = "B"
ActiveCell.Offset(1, 1) = "BMay"
ActiveCell.Offset(1, 2) = "BJoe"

End Sub

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


"FirstVette52" wrote:

That puts the next value in a new row, but the next value needs to go in a
new column on the same row. Once all the values have been entered then it
needs to go to a new row.

Thanks for your help
--
FirstVette52


"Jacob Skaria" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Macro to enter a value, tab to next cell in the row, enter ...

That gets it in the second row, but the cell focus is still on the first cell
when the macro finishes. Is there some way to get it to move down to the
next row? I've figured out that I can use a variable for the Active Cell
address after the ' ActiveCell = "A" ' (something like rw =
ActiveCell.Address), and then set the range at the end to rw, but I havn't
figured out how to get it to the next row after that.

Thx!
--
FirstVette52


"Jacob Skaria" wrote:

Sub A_FILLIN()
ActiveCell = "A"
ActiveCell.Offset(0, 1) = "May"
ActiveCell.Offset(0, 2) = "Joe"
ActiveCell.Offset(1, 0) = "B"
ActiveCell.Offset(1, 1) = "BMay"
ActiveCell.Offset(1, 2) = "BJoe"

End Sub

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


"FirstVette52" wrote:

That puts the next value in a new row, but the next value needs to go in a
new column on the same row. Once all the values have been entered then it
needs to go to a new row.

Thanks for your help
--
FirstVette52


"Jacob Skaria" wrote:

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

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
Macro to enter a value, tab to next cell in the row, enter ... Jacob Skaria Excel Programming 0 July 10th 09 01:54 PM
Macro to select cells in column enter data then press enter NP New Users to Excel 1 February 20th 08 04:21 PM
Enter multiple numbers in a cell so total shows when enter keypres newbie Excel Worksheet Functions 2 August 19th 07 12:23 PM
Enter data and press enter to move to specific cell Programing problem[_2_] Excel Programming 2 January 10th 07 03:35 AM
Auto enter date when data in enter in another cell Brian Excel Worksheet Functions 5 December 7th 06 06:44 PM


All times are GMT +1. The time now is 04:39 PM.

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"