[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Move to another cell

Posted on 2013-12-03
12
Medium Priority
?
206 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
  • 6
  • 3
  • 3
12 Comments
 
LVL 34

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 34

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 34

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
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.

830 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