neep help controlling Application.MoveAfterReturn

tbablue

Active Member
Joined
Apr 29, 2007
Messages
488
Office Version
  1. 365
Platform
  1. Windows
Hi.

I need help controlling Application.MoveAfterReturn.

I want to set it to False ONLY when a cell in C4:C13 is the activecell.


Private Sub Worksheet_Change(ByVal Target As Range)

Application.MoveAfterReturn = False

If Target.Count > 1 Then Exit Sub
If Intersect(Me.Range("c4:c13"), Target) Is Nothing Then Exit Sub

Application.MoveAfterReturn = False

If InRange(ActiveCell, Range("c4:c13")) Then

Application.MoveAfterReturn = False

ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"", ScreenTip:="CLICK TO PROGRESS"

MsgBox "Hyperlink Available!"

Else
' code to handle that the active cell is not within the right range
MsgBox "Active Cell NOT In Range!"
End If

Application.MoveAfterReturn = True

End Sub


Any help welcomed.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi, :)

try:

Code:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    Application.MoveAfterReturn = IIf(Not Intersect(Me.Range("C4:C13"), Target) Is Nothing, False, True)
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,317
Members
452,905
Latest member
deadwings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top