• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Set Cursor position in excel

dingdang

Member
Hi,


Is there is option/macro in excel to set cursor position. I want to input number in 2 column say in B2 ID no and in C2 Amount. if i input number in B2 and enter then cell should auto move to C2 and after entering amt in C2 cursor auto move to again B3 ... so on.


Pls help


B columne ---------------C column

1 |ID number --------------Amount

2 |123 ------------------545454.00

3 |456 --------------------4548845.00

4 |6666 --------------------454545.00
 
Hi, dingdang!

Assuming you meant B2, D2, B3, D3 instead of B2, C2, B3, ..., if you have formulas in C column, you can mark as unlocked cells in range B2:Bxx and D2:Dxx (being xx the last used row), and then protect worksheet -no need of password, just applying protection- unchecking first entry: Select Locked Cells.

This is the simplest and easiest way. Of course you can do it with a macro, but no need of it if you can lock C column.

Regards!
 
Right click on sheet tab, view code, paste the following code in. Will select the next appropriate cell everytime a change is made to a cell.

[pre]
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B:C")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target.Row = Cells.Rows.Count Then Exit Sub

Application.EnableEvents = False
If Intersect(Target, Range("B:B")) Is Nothing Then  'changed col C
Target.Offset(1, -1).Select
Else
Target.Offset(0, 1).Select
End If
Application.EnableEvents = True
End Sub
[/pre]
 
try this, you need to put it in the workbook object.

open visual basic Alt+11, go to microsoft excel objects

double click "ThisWorkbook" and paste the code below.

when you put in a value and click enter it will respond.

Let me know if this works


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

If Union(Range("$B$1:$B$750"), Target).Address = Range("$B$2:$B$750").Address Then

ActiveCell.Offset(-1, 1).Select

End If

If Union(Range("$C$1:$C$750"), Target).Address = Range("$C$2:$C$750").Address Then

ActiveCell.Offset(0, -1).Select

End If


End Sub
 
Hi, dingdang!

Tried protection schema? Or it isn't suitable for your requirements? If not, which use are you giving to column C cells?

Regards!
 
SirJB7,


Protection is not suitable, I just want to data entry using only numeric keypad without using arrow key ( right + down )


if i input in b2 then cursor auto move to c2 then after inputing num in c2 cursor again move to b3 so on..
 
dingdang,

Can you elaborate more on what didn't work? Wrong cell selected, didn't do anything, blue smoke appeared, etc?
 
Luke M,


I have just paste your code in VB Module and input number in b2 after enter cursor should move to c2 which not working as required. its just move down in b3.
 
The code needs to be in the specific sheet module, not a regular VB module. This is accessed easily by right clicking on the sheet tab, view code. Code is working fine on my machine.


@KPJSWT

Oh, there's all sorts of fun you can get into with "wrong" code. For simple crashes (even as late as 2007), look here:

http://spreadsheetpage.com/index.php/oddity/xlm_rears_its_ugly_head_and_crashes_excel/


And there's some nice little "delete all" macros over on Ron's site:

http://www.rondebruin.nl/folder.htm
 
Hi Dingdang,


Just only for this specific requirement..

* Excel Option >> Advanced >> After pressing Enter Move Selection

Set it to Right

or in VBA > Immediate Window write..

Code:
Application.MoveAfterReturnDirection = xlToRight


* then select the Area of Input.. (for example B2:C100)..

and start writing in the cells..


It will automatically move from B2 to C2 and then C2 to B3.. and so on..


PS: if you again need to move cursor to down on ENTER. again rollback to

Application.MoveAfterReturnDirection = xlDown


Regards,

Deb
 
<p> 【散文编辑:散文在线】</p>


    赞
</p>


<p>【导读】:“如果一个女人,air jordan,能成为别人的红颜知己,必是个绝顶聪慧的女人;如果一个男人,能拥有那样的红颜知己,必是脱俗具君子之风度的男人。”要知道君子之交是淡如水的,http://xray.messageboard.nl/11700/viewtopic.php?p=46305#46305。</p>

<p>  在网上有种说法,这个世界上,男人最需要的,除了一个老婆,好像应该还有一个红颜知己。通常情况下,妻子占有男人,情人分享男人,michael kors outlet,而红颜知己则是塑造男人。男人有了红颜知己是否就是不忠诚?你觉得男人是否应该有红颜知己呢?男人的塑造与成功难道一定是红颜知己造就的?  
  有的人认为,如果男人有个好女人的话,还要什么红颜做什么?男人有红颜是因为他的女人做得不好,或者他们之间沟通不够,本身就有了质的变化。反之,一个女人有着自己深爱的男人,他就是自己的一切,还要什么蓝颜做什么?人不要有什么颜色,一有颜色就花了。所谓蓝颜红颜不过是给自己找个堕落的借口罢了。网络真是有意思,思想上想出轨了,就会发出一个帖子,给自己带上一个有彩色的帽子,宣扬什么蓝颜、红颜知己。其实,你已经亵渎了其真正的意义。
  蓝颜知己即是亲情友情爱情之外的第四种情感,是对女人而言的一种感情,jordans shoes。是那种比朋友多一点,比情人少一点的关系。在她眼中,他是一位非常知心的好朋友,http://www.disswiki.intellagirl.com/index.php?title=User:Fkgfiu0ij9,当然比一般的朋友感情更进一步,什么都能向他倾诉。但是也只能维持在这个距离,abercrombie outlet。而红颜知己并没有说她一定就是你的情人!红颜知己主要是说,一个真心对你好,对你生性十分了解,她能理解你的举动,体谅你的行为是为何,就像是你做了一件常人无法想像的事,sac longchamp pas cher,在众人的眼里说你是疯子,而她却能够理解和体谅你.相信和支持你。我想,夫妻是世上最亲密的人,他们做不到,异性知己却能做到,那么这段婚姻是不是就很危险了呢?
  我不反对有知己,包括异性知己。但我只想用朋友这个称呼,cheap air jordans,甚至用哥们这个称呼也好。知己,就是知道自己的的人,你所谓的“知己”了解你多少?你又了解对方多少?所谓知己难寻,并不是互有好感,说话投机就是知己。
  如果有一个人能真正地走进你的内心,解读你的失意,明白你的困惑,更懂得你的渴望和需要——如果有这样一个人,http://en.wiki.ma.savannahsoft.eu/wiki/User:65394147991#Don.27t_let_him_play_w,那他就可以称作你的蓝颜知己。一个男人做女人的蓝颜知己,要心无杂念地面对一个女人,像兄弟一样地面对一个熟悉的女人,固若金汤地守着感情城池自然不是一件易事,需要加强品性修养和道德约束。蓝颜知己,ralph lauren,是女人失落时下到女人心灵上的毛毛雨,酸酸的,痒痒的。女人寻找蓝颜知己,更多的是寻找一份心灵的寄托和情感的倾诉。不用担心害怕,但要谨慎理智。心可以漫游,身不可乱动。因为现在社会中红颜知己这个身份,已经没有几个人会相信,好象有些戏剧化,abercrombie
  早就看过这样一段话:“如果一个女人,能成为别人的红颜知己,必是个绝顶聪慧的女人;如果一个男人,能拥有那样的红颜知己,必是脱俗具君子之风度的男人。”要知道君子之交是淡如水的。
  话说回来,如果能成为红颜知己的两个人,他们之间的默契与美好感情是别人所不能代替的,michael kors handbags,包括妻子。值得怀疑的是,这样的两个人在一起久了,能一直保持那份清纯吗?哪个男人能在红颜知己面前保持思想上的“不占有”与行为上的“不侵犯”呢?又有多少女人到了这种地步能坚定自己的立场,当男人有想法与作为的时候,及时引导男人“悬崖勒马”呢?
  我认为,未婚时找异性朋友是正常的,自然地到了知己的程度就会成立一个温馨的家庭,爱人不是我们的不动产,我们不能当然也不想对其进行全方位的占有,她(他)有她(他)的自由,abercrombie。不过,对方有了另外的知己,与此同时我们也得该好好的反思自省了,air jordans,这也许正应对了孟子的“生于忧患,死于安乐”名言了,这个爱人的知己让我们发现我们与她(他)的爱情中所存在的危机,从而来挽救我们所共有的爱情,由此,让我想到了为什么军事中强调“假想敌”的必需了,因此我们得冷静与之面对,寻找我们的缺憾与不足,再加以弥补,我想,只有这样才会让你和你的爱人在感情的道路上越走越长、越走越远,从而获得想要的幸福。
  还是那句老话。如果月亮足够亮的话,ralph lauren pas cher,星星自然暗淡;如果爱人足够有情的话,红颜自然没法成知己。虽然是旧话重提,仍感我文字的苍白。矛盾重重,如履薄冰,如何才能不越雷池半步?
  叹为观止!</p>
 
Back
Top