Excel Macro to start cursor at a specific field

I am using the following code to tab from F to G. Then it goes down to F then G again and so on and so on. I am just entering data into the F and G field. What i need is when open the cursor automatically starts at F6. Here is my code. Can I add anything to start at F6?

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Column > 7 Then
     Application.EnableEvents = False
     Target.Offset(1, -Target.Column + 6).Select
     Application.EnableEvents = True
End If
End Sub

allenkentAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

point_pleasantCommented:
try
Range("F6").Select
Brian GeeCommented:
I just tested this and it worked for me:

Option Explicit

Private Sub Workbook_Open()
     Range("F6").Select
End Sub

Open in new window

allenkentAuthor Commented:
I tried plugging in and get errors. Here is my code. Do I put the F6 after the word range?

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Column > 7 Then
     Application.EnableEvents = False
     Target.Offset(1, -Target.Column + 6).Select
     Application.EnableEvents = True
End If
End Sub
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Brian GeeCommented:
Using the code I put above (you can exclude the Option Explicit), once you open your Workbook, the cell F6 will be selected. It's using the Open action of the Workbook to trigger the F6 cell selection.
allenkentAuthor Commented:
What about my code? I need both things to happen. When I put both codes I get an error. I need it to open at F6 and only go from F to G on tabs.
point_pleasantCommented:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Range("F6").Select
If Target.Column > 7 Then
     Application.EnableEvents = False
     Target.Offset(1, -Target.Column + 6).Select
     Application.EnableEvents = True
End If
End Sub
Brian GeeCommented:
Both events can co-exist. One just addresses what to perform at Worksheet open, and the other runs your IF statement upon a Worksheet change event.

Private Sub Workbook_Open()
     Range("F6").Select
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
     If Target.Column > 7 Then
          Application.EnableEvents = False
          Target.Offset(1, -Target.Column + 6).Select
          Application.EnableEvents = True
     End If
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
allenkentAuthor Commented:
Point Pleasant code does not let me go anywhere except F6. It always stays in F6
Yobri code does not start in F6 but instead it opens in A41 everytime.

point_pleasantCommented:
not seeing the code beore the sub call


Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)


i would suggest you move the

Range("F6").Select


before the call is made to your sub


Brian GeeCommented:
Could you try closing Excel entirely and then relaunching it? That Workbook_Open sub really should leave no other option but to select cell F6 at open...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.