Visual Basic code for macros

  • Thread starter Thread starter Derek Peters
  • Start date Start date
D

Derek Peters

I'm trying to write a macro to transfer new data from one sheet in a workbook
to another. To do it I need to navigate from the active cell to others by
using the active cell as a reference point and moving by "R[+n]C[-x]" rather
than by a specific cell address (eg H4) referenced from the top left corner.
Is there a way I can get a useable return from the ActiveCell function, or
any other code structure that might give me the result I'm looking for?
I'm using Excel 2002 and Visual Basic Version 6.3.
Thank you.
 
maybe you could use

activecell.offset(n,-x)



Derek said:
I'm trying to write a macro to transfer new data from one sheet in a workbook
to another. To do it I need to navigate from the active cell to others by
using the active cell as a reference point and moving by "R[+n]C[-x]" rather
than by a specific cell address (eg H4) referenced from the top left corner.
Is there a way I can get a useable return from the ActiveCell function, or
any other code structure that might give me the result I'm looking for?
I'm using Excel 2002 and Visual Basic Version 6.3.
Thank you.
 
Thank you for the suggestion Dave, it certainly looks like it ought to work
but I get either a Syntax Error or a Compile Error all the time, even when I
use the syntax that suggested in Help.

Dave Peterson said:
maybe you could use

activecell.offset(n,-x)



Derek said:
I'm trying to write a macro to transfer new data from one sheet in a workbook
to another. To do it I need to navigate from the active cell to others by
using the active cell as a reference point and moving by "R[+n]C[-x]" rather
than by a specific cell address (eg H4) referenced from the top left corner.
Is there a way I can get a useable return from the ActiveCell function, or
any other code structure that might give me the result I'm looking for?
I'm using Excel 2002 and Visual Basic Version 6.3.
Thank you.
 
Example: To move to the cell 3 rows down and 2 columns right this is the
syntax to use:

ActiveCell.Offset(3, 2).Select



--
Jim
| Thank you for the suggestion Dave, it certainly looks like it ought to
work
| but I get either a Syntax Error or a Compile Error all the time, even when
I
| use the syntax that suggested in Help.
|
| "Dave Peterson" wrote:
|
| > maybe you could use
| >
| > activecell.offset(n,-x)
| >
| >
| >
| > Derek Peters wrote:
| > >
| > > I'm trying to write a macro to transfer new data from one sheet in a
workbook
| > > to another. To do it I need to navigate from the active cell to others
by
| > > using the active cell as a reference point and moving by "R[+n]C[-x]"
rather
| > > than by a specific cell address (eg H4) referenced from the top left
corner.
| > > Is there a way I can get a useable return from the ActiveCell
function, or
| > > any other code structure that might give me the result I'm looking
for?
| > > I'm using Excel 2002 and Visual Basic Version 6.3.
| > > Thank you.
| >
| > --
| >
| > Dave Peterson
| >
 
Back
Top