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?
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?
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,Target.Column +1).Select
End If
Last edited by TommySzalapski; 07-26-2005 at 04:34 PM.
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
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
>
>
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" <[email protected]> wrote in
message news:[email protected]...
> 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
> >
> >
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" <[email protected]> wrote in
message news:[email protected]...
> 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
> >
> >
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
>
>
Did you save the workbook after you added the code?
--
Regards,
Tom Ogilvy
"Programming Cells" <[email protected]> wrote in
message news:[email protected]...
> 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
> >
> >
yes I did
"Tom Ogilvy" wrote:
> Did you save the workbook after you added the code?
>
> --
> Regards,
> Tom Ogilvy
>
> "Programming Cells" <[email protected]> wrote in
> message news:[email protected]...
> > 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
> > >
> > >
>
>
>
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.
Last edited by TommySzalapski; 07-26-2005 at 04:34 PM.
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
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks