Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Offset Problem


I'm having a problem using offset with Worksheet_Change(). What I want
to accomplish is when the person finishes entering a value in the
current cell to move down one and to the left one.

Right now I have my code in the Worksheet_Change event but this makes
the active cell the next cell and then runs my code which offsets the
cell to the wrong cell.

All I want to do is make it easy for the user to enter data so that it
basically acts as a carriage return.

If you need more information let me know and I'll try to clarify
better.

Thanks,
Chris


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Offset Problem

Chris,

If I understand your question correctly, all you need to do go to the Tools
menu, choose Options then the Edit tab, and check the "Move selection after
Enter" setting, and set the direction setting to down. You can set this
with VBA with code like

Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlDown


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"cford31" wrote in message
...

I'm having a problem using offset with Worksheet_Change(). What I want
to accomplish is when the person finishes entering a value in the
current cell to move down one and to the left one.

Right now I have my code in the Worksheet_Change event but this makes
the active cell the next cell and then runs my code which offsets the
cell to the wrong cell.

All I want to do is make it easy for the user to enter data so that it
basically acts as a carriage return.

If you need more information let me know and I'll try to clarify
better.

Thanks,
Chris


------------------------------------------------
~~ Message posted from
http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Offset Problem


Thanks for the reply Chip,

That would solve my problem if I had only one column but I have two
columns and after they finish entering the value in the second column I
want it to move to the first cell on the next row (Down one, Left one).


Here is my code:


Private Sub Worksheet_Change(ByVal Target As Range)

Dim pvtTable As PivotTable
Dim intColumn As String

intColumn = Target.Column
If intColumn = 2 Then
ActiveCell.Offset(1, -1).Select
End If

Set pvtTable = Worksheets("Sheet1").Range("D2").PivotTable
pvtTable.RefreshTable

End Sub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Offset Problem


I think I solved my problem by changing ActiveCell.Offset to
Target.Offset

Thanks for the help.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Offset Problem

select the area where you want to enter data and then use Tab instead of
enter.

--
Regards,
Tom Ogilvy

"cford31" wrote in message
...

Thanks for the reply Chip,

That would solve my problem if I had only one column but I have two
columns and after they finish entering the value in the second column I
want it to move to the first cell on the next row (Down one, Left one).


Here is my code:


Private Sub Worksheet_Change(ByVal Target As Range)

Dim pvtTable As PivotTable
Dim intColumn As String

intColumn = Target.Column
If intColumn = 2 Then
ActiveCell.Offset(1, -1).Select
End If

Set pvtTable = Worksheets("Sheet1").Range("D2").PivotTable
pvtTable.RefreshTable

End Sub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
OFFSET problem alan82 Excel Worksheet Functions 4 November 20th 08 02:55 AM
Offset Problem Dawn Excel Discussion (Misc queries) 4 June 11th 08 06:44 PM
OFFSET PROBLEM txm49 Excel Discussion (Misc queries) 2 October 11th 07 08:15 PM
Offset VBA Problem jlclyde Excel Discussion (Misc queries) 3 September 18th 07 04:00 PM
Offset Problem morrida3 New Users to Excel 1 September 16th 05 08:02 PM


All times are GMT +1. The time now is 06:33 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"