Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Move to another cell

Posted on 2013-12-03
12
Medium Priority
?
205 Views
Last Modified: 2013-12-03
Folks,
In cell O2 I enter this formula =TODAY() and press <Enter> and then I want to go to Range("L3"). I've tried =if range("O2")<>"" then Range ("L3") but I do not know if it is correct or where to place the code?
0
Comment
Question by:Frank Freese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
12 Comments
 
LVL 33

Expert Comment

by:Rob Henson
ID: 39692858
This code will move the cursor from O2 to L3 after O2 is changed.

Private Sub Worksheet_Change(ByVal Target As Range)

If ActiveCell.Row = 2 And ActiveCell.Column = 15 Then Range("L3").Select

End Sub

To implement, right click on the sheet tab and select view code, copy and paste the above into the right hand side of the VB Editor.

Thanks
Rob H
0
 
LVL 33

Assisted Solution

by:Rob Henson
Rob Henson earned 1000 total points
ID: 39692870
Looking at the bigger picture, what are you trying to achieve? A similar result is possible without VBA.

If the sheet is protected, O2 is unlocked and L3 is the next available unlocked cell and move on enter is activated, the cursor will go to the next available cell.

Thanks
Rob H
0
 

Author Comment

by:Frank Freese
ID: 39692876
Hmmm...you second comment is applicable also.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Frank Freese
ID: 39692924
Neither of your suggestions worked? Attached is my file.
Locked-cells-Revised.xlsm
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 1000 total points
ID: 39692955
Use

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("o2").Address Then
If Target <> "" Then Range("L3").Select
End If

End Sub
0
 

Author Comment

by:Frank Freese
ID: 39692964
Rob,
whoops! the second alternative worked fine. I forgot I had one cell left unprotected.I still would like a "shooting soultion" in VBA though. I tried your and that did not work, for me.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39692974
Did you try the code I gave?
0
 

Author Closing Comment

by:Frank Freese
ID: 39692986
thanks folks - I've got it now.
0
 

Author Comment

by:Frank Freese
ID: 39693064
ssaqibh,
Yes your code worked fine. Appreciate it!
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 39693151
@ssaqibh - do you have any suggestions why mine did not work when it basically does the sames as yours?
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39693162
Hi, Rob, you should have used target instead of activecell.
0
 

Author Comment

by:Frank Freese
ID: 39693205
thanks for the follow up. The part of Rob's answer I accepted was "If the sheet is protected, O2 is unlocked and L3 is the next available unlocked cell and move on enter is activated, the cursor will go to the next available cell."
I found a cell that was left unlocked when it should not have been and once I corrected that problem Rob's suggestion worked. However, the code was needed also.
Great job folks!
Frank
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question