By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,983 Members | 2,049 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,983 IT Pros & Developers. It's quick & easy.

Code for moving focus

P: 3
Hi All,

I am trying to develop a form in Vb that stores data in perticular cells based macthing value to the row and colum values in a table.
I can get focus on the colum value of the table but need to move the focus from 6 colums to the right from the activecell.

How do i do this? Your help will be greatly appreciated.

Thank You in advance.

Vishwas
Apr 9 '07 #1
Share this Question
Share on Google+
5 Replies


Expert 5K+
P: 8,434
I am trying to develop a form in Vb that stores data in perticular cells based macthing value to the row and colum values in a table.
I can get focus on the colum value of the table but need to move the focus from 6 colums to the right from the activecell.
Can you tell us what version of VB you are using, and what controls you are using?
Apr 9 '07 #2

P: 3
Can you tell us what version of VB you are using, and what controls you are using?
i am using Vb in MS office (excel) 2003 , I am using text boxes and a command botton.

Thank You
Apr 9 '07 #3

Expert 5K+
P: 8,434
i am using Vb in MS office (excel) 2003 , I am using text boxes and a command button.
In that case, you're not actually using VB - it's VBA. Similar, but not identical.

It sounds as though what you want to use is the Offset function (actually, I think it might be a method) to specify a location relative to the current cell..
Apr 9 '07 #4

P: 3
Hi killer42

Mate i sincerely appreciate your help,

I am an accountant trying to figure out easier way of doing things on excel,
i found that focus from current cell to where you want by using for example a sample code as below.

If (SngBustype = "B/Tax") Then
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveCell.FormulaR1C1 = CurAmount

Thank You
Vishwas
Apr 9 '07 #5

Expert 5K+
P: 8,434
I am an accountant trying to figure out easier way of doing things on excel, i found that focus from current cell to where you want by using for example a sample code as below.

If (SngBustype = "B/Tax") Then
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveCell.FormulaR1C1 = CurAmount
Glad to see you've got your solution. :)

Don't forget, you can combine things. For instance, you could (probably) have said...
Expand|Select|Wrap|Line Numbers
  1. ActiveCell.Offset(0, 3).Range("A1").FormulaR1C1 = CurAmount
to get the same effect without moving the focus.
Apr 9 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.