ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Entering Data (https://www.excelbanter.com/excel-programming/335566-entering-data.html)

Programming Cells[_2_]

Entering Data
 
I want to be able to enter numbers into cells A1 through A10. Once I've
reached cell A10 I want it to automatically jump to Cell B1. How can I
accomplish this?

jjk

Entering Data
 
I guess this is what you are looking for.
I have hardcoded it for selection of row 11. You can play around with
that.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Row = 11 Then
Target.Offset(1 - Target.Row, 1).Select
End If

End Sub


Programming Cells

Entering Data
 
Do I just enter this code into Cell A11???

"jjk" wrote:

I guess this is what you are looking for.
I have hardcoded it for selection of row 11. You can play around with
that.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Row = 11 Then
Target.Offset(1 - Target.Row, 1).Select
End If

End Sub



TommySzalapski[_11_]

Entering Data
 

Use this code. This is the SelectionChange event.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$10" Then
Range("B10").Select
End If
End Sub

or to do it for every column

If Target.Row = 10 then
Cells(1,Taget.Column +1).Select
End If


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=390277


Tom Ogilvy

Entering Data
 
Chip Pearson's page on Events
http://www.cpearson.com/excel/events.htm

you would place it in the Sheet module of the sheet where you want the
activity. right click on the sheet tab and select view code.

--
Regards,
Tom Ogilvy

"Programming Cells" wrote in
message ...
Do I just enter this code into Cell A11???

"jjk" wrote:

I guess this is what you are looking for.
I have hardcoded it for selection of row 11. You can play around with
that.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Row = 11 Then
Target.Offset(1 - Target.Row, 1).Select
End If

End Sub





Nigel

Entering Data
 
No. You enter into the code sheet behind the worksheet. Right-click on the
worksheet tab and choose View Code, the editor opens, and paste the code
there.

--
Cheers
Nigel



"Programming Cells" wrote in
message ...
Do I just enter this code into Cell A11???

"jjk" wrote:

I guess this is what you are looking for.
I have hardcoded it for selection of row 11. You can play around with
that.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Row = 11 Then
Target.Offset(1 - Target.Row, 1).Select
End If

End Sub





Programming Cells

Entering Data
 
What if I want to save the document and go back into it another time.

How do I maintain the source code.

Currently when I exit and go back in the source does not work anymore.

"TommySzalapski" wrote:


Use this code. This is the SelectionChange event.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$10" Then
Range("B10").Select
End If
End Sub

or to do it for every column

If Target.Row = 10 then
Cells(1,Taget.Column +1).Select
End If


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=390277



Tom Ogilvy

Entering Data
 
Did you save the workbook after you added the code?

--
Regards,
Tom Ogilvy

"Programming Cells" wrote in
message ...
What if I want to save the document and go back into it another time.

How do I maintain the source code.

Currently when I exit and go back in the source does not work anymore.

"TommySzalapski" wrote:


Use this code. This is the SelectionChange event.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$10" Then
Range("B10").Select
End If
End Sub

or to do it for every column

If Target.Row = 10 then
Cells(1,Taget.Column +1).Select
End If


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile:

http://www.excelforum.com/member.php...o&userid=25561
View this thread:

http://www.excelforum.com/showthread...hreadid=390277





Programming Cells

Entering Data
 
yes I did

"Tom Ogilvy" wrote:

Did you save the workbook after you added the code?

--
Regards,
Tom Ogilvy

"Programming Cells" wrote in
message ...
What if I want to save the document and go back into it another time.

How do I maintain the source code.

Currently when I exit and go back in the source does not work anymore.

"TommySzalapski" wrote:


Use this code. This is the SelectionChange event.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$10" Then
Range("B10").Select
End If
End Sub

or to do it for every column

If Target.Row = 10 then
Cells(1,Taget.Column +1).Select
End If


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile:

http://www.excelforum.com/member.php...o&userid=25561
View this thread:

http://www.excelforum.com/showthread...hreadid=390277






TommySzalapski[_13_]

Entering Data
 

Go to tools - Macro - Security and change the security level from hig
to medium. Reopen your file and click Enable when it asks about macros
If that does not work than you have somehow deleted your code. And
apologize for the error in my first post. Those numbers should hav
been 11, not 10. Thank for the correction jjk

--
TommySzalapsk
-----------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...fo&userid=2556
View this thread: http://www.excelforum.com/showthread.php?threadid=39027


Programming Cells

Entering Data
 
no problem. i found that i did not have the complete vb authorization
package installed.

This works great. Thanks.

Can I also put in a macro so that if I do not reach the end of the cell I
can manually call a macro that forces me to the next beginning cell?

"TommySzalapski" wrote:


Go to tools - Macro - Security and change the security level from high
to medium. Reopen your file and click Enable when it asks about macros.
If that does not work than you have somehow deleted your code. And I
apologize for the error in my first post. Those numbers should have
been 11, not 10. Thank for the correction jjk.


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=390277




All times are GMT +1. The time now is 05:55 PM.

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