Link to home
Start Free TrialLog in
Avatar of megaman5
megaman5Flag for United States of America

asked on

Excel Macro Question

I am trying to build & run a macro in Excel 2010 to return to a certain cell on the next row after hitting enter. I just don't think I'm recording it right.
 
So, below, I have excel to move right after hitting enter.  At the end of the data, where it says Balance, I’d like it to go to the Previous Unbilled Balance cell on the next line.  I know there’s a way to do it, but I’m getting stuck.  I’ve googled it with no luck.

Thanks!
img.png
Avatar of kgerb
kgerb
Flag of United States of America image

Paste this code into your worksheet code module.  Modify the variables "BalCol" and "PrevBalcol" to be the letters of the corresponding columns containing your Balance and Previous Unbilled Balance cells.

Let me know if you need other assistance.

Kyle
Private Sub Worksheet_Change(ByVal Target As Range)
Dim BalCol As String, PrevBalcol As String
BalCol = "C"
PrevBalcol = "K"
If Not Application.Intersect(Columns(BalCol), Target) Is Nothing Then
    Cells(Target.Row + 1, PrevBalcol).Select
End If
End Sub

Open in new window

SOLUTION
Avatar of kgerb
kgerb
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial