Conditionalmovement of cursor

  • Thread starter Thread starter sudhanshu
  • Start date Start date
S

sudhanshu

Hi.

1) In a Excel sheet I have put up a criteria using IF function. M
reuirement is that the cursor should move automatically to differen
cell references based on fullfillment of criteria.

For example, If cell B1 returns value as 5, cursor should move to cel
C7 or if B1 returns 7 then cursor should move to D5 and so on.

I am unable to figure out, how this can be done?

2) Is it possible to use IF or COUNT function (formula) alongwith GO T
(Command)? I have tried this but it gives error.

Can somebody help me out?

Thanking you in advance

Sudhansh
 
Hi
this can only be done with VBA (using an event procedure). You may try
the following (though maybe you should consider a different approach
instead of using such kind of macros): Put this code in your worksheet
module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.count > 1 Then Exit Sub
If Intersect(Target, Me.Range("B1")) Is Nothing Then Exit Sub
With Target
Select Case .Value
Case 5
Range("C7").Select
Case 7
Range("D5").Select
End Select
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top