Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default Move cursor to specific cell from a specific cell

I hope I can explain myself clearly enough to explain what I want to
accomplish. I'm using columns B through G and sometimes H. What I'd like to
have happen is if I hit enter after typing something in column H then the
cursor will go to the cell in column C of the same row (because it will be
blank).

Here's what it will look like:
Col B Col C Col D Col E Col F Col G Col H
EXAMPLE (blank) Clare 9/10 0607 018 see Clare co.

So after i type in Col H "see Clare Co." and hit enter, the cursor moves to
Col C in ths same row. I will then link the date from Clare Co. to that cell.

You vba-ers have been kick butt so far. Let's see what you got.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Move cursor to specific cell from a specific cell

Put this isn the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set h = Range("H:H")
If Intersect(Target, h) Is Nothing Then Exit Sub
Cells(Target.Row, "C").Select
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200802


"JSnow" wrote:

I hope I can explain myself clearly enough to explain what I want to
accomplish. I'm using columns B through G and sometimes H. What I'd like to
have happen is if I hit enter after typing something in column H then the
cursor will go to the cell in column C of the same row (because it will be
blank).

Here's what it will look like:
Col B Col C Col D Col E Col F Col G Col H
EXAMPLE (blank) Clare 9/10 0607 018 see Clare co.

So after i type in Col H "see Clare Co." and hit enter, the cursor moves to
Col C in ths same row. I will then link the date from Clare Co. to that cell.

You vba-ers have been kick butt so far. Let's see what you got.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default Move cursor to specific cell from a specific cell

Gary's Student, the sheet the opened when I clicked on "view code" already
had a Private Sub Worksheet_Change(ByVal Target As Range) formula in it. I
included the set h = Range("H:H") through Cells(Target.Row... but it didn't
work.

Here's the coding already in that sheet:
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo Whoops
If Target.Count = 1 Then
If Target.Column = 2 Then 'this number picks the column: 1 is
column A, 2 is column B etc
If Target.Row 1 Then 'ignore row 1 which is probably a header
Target.Value = UCase(Target.Value)
End If
End If
If Target.Column = 4 Then 'this number picks the column: 1 is
column A, 2 is column B etc
If Target.Row 1 Then 'ignore row 1 which is probably a header
Target.Value = StrConv(Target.Value, vbProperCase)
End If
End If
End If

Whoops:
Application.EnableEvents = True

Set t = Target
Set b = Range("C:F")
If Intersect(t, b) Is Nothing Then Exit Sub
If t.NumberFormat = "General" Then Exit Sub
Dim s As String
s = t.Value
If Left(s, 1) < "=" Then Exit Sub
Application.EnableEvents = False
t.NumberFormat = "General"
t.Formula = s
Application.EnableEvents = True

End Sub

I actually have 26 sheets (1 for each letter of the alphabet). Could I use
your code in the ThisWorkbook page?

"Gary''s Student" wrote:

Put this isn the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set h = Range("H:H")
If Intersect(Target, h) Is Nothing Then Exit Sub
Cells(Target.Row, "C").Select
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200802


"JSnow" wrote:

I hope I can explain myself clearly enough to explain what I want to
accomplish. I'm using columns B through G and sometimes H. What I'd like to
have happen is if I hit enter after typing something in column H then the
cursor will go to the cell in column C of the same row (because it will be
blank).

Here's what it will look like:
Col B Col C Col D Col E Col F Col G Col H
EXAMPLE (blank) Clare 9/10 0607 018 see Clare co.

So after i type in Col H "see Clare Co." and hit enter, the cursor moves to
Col C in ths same row. I will then link the date from Clare Co. to that cell.

You vba-ers have been kick butt so far. Let's see what you got.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Move cursor to specific cell from a specific cell

If you already have a Worksheet_Change sub, keep it. Remove my sub.

In YOUR sub include the following lines directly after the Private line:

Set h = Range("H:H")
If Intersect(Target, h) Is Nothing Then
Else
Cells(Target.Row, "C").Select
Exit Sub
End If

This leaves your original logic intact. We are just adding a check that if
something is entered in col H, a jump is made back to column C.
--
Gary''s Student - gsnu200802


"JSnow" wrote:

Gary's Student, the sheet the opened when I clicked on "view code" already
had a Private Sub Worksheet_Change(ByVal Target As Range) formula in it. I
included the set h = Range("H:H") through Cells(Target.Row... but it didn't
work.

Here's the coding already in that sheet:
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo Whoops
If Target.Count = 1 Then
If Target.Column = 2 Then 'this number picks the column: 1 is
column A, 2 is column B etc
If Target.Row 1 Then 'ignore row 1 which is probably a header
Target.Value = UCase(Target.Value)
End If
End If
If Target.Column = 4 Then 'this number picks the column: 1 is
column A, 2 is column B etc
If Target.Row 1 Then 'ignore row 1 which is probably a header
Target.Value = StrConv(Target.Value, vbProperCase)
End If
End If
End If

Whoops:
Application.EnableEvents = True

Set t = Target
Set b = Range("C:F")
If Intersect(t, b) Is Nothing Then Exit Sub
If t.NumberFormat = "General" Then Exit Sub
Dim s As String
s = t.Value
If Left(s, 1) < "=" Then Exit Sub
Application.EnableEvents = False
t.NumberFormat = "General"
t.Formula = s
Application.EnableEvents = True

End Sub

I actually have 26 sheets (1 for each letter of the alphabet). Could I use
your code in the ThisWorkbook page?

"Gary''s Student" wrote:

Put this isn the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set h = Range("H:H")
If Intersect(Target, h) Is Nothing Then Exit Sub
Cells(Target.Row, "C").Select
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200802


"JSnow" wrote:

I hope I can explain myself clearly enough to explain what I want to
accomplish. I'm using columns B through G and sometimes H. What I'd like to
have happen is if I hit enter after typing something in column H then the
cursor will go to the cell in column C of the same row (because it will be
blank).

Here's what it will look like:
Col B Col C Col D Col E Col F Col G Col H
EXAMPLE (blank) Clare 9/10 0607 018 see Clare co.

So after i type in Col H "see Clare Co." and hit enter, the cursor moves to
Col C in ths same row. I will then link the date from Clare Co. to that cell.

You vba-ers have been kick butt so far. Let's see what you got.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default Move cursor to specific cell from a specific cell

Gary's Student - that's why you're the best! It worked like a charm.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MOVE FROM SPECIFIC CELL TO ANOTHER SPECIFIC CELL JAYC099 Excel Worksheet Functions 2 August 14th 08 05:33 PM
How do I direct cursor to a specific cell? Sandman Excel Discussion (Misc queries) 2 June 3rd 08 06:36 PM
need to move cursor to specific fields Cindy Excel Worksheet Functions 1 January 17th 08 11:59 PM
How do I move to a specific cell in Excel? JAConnolly Excel Discussion (Misc queries) 9 March 7th 07 01:18 AM
Move text that is a specific color to a different cell Alison84 Excel Worksheet Functions 3 November 15th 06 04:12 PM


All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"