View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Corey Corey is offline
external usenet poster
 
Posts: 172
Default How do i write an offset code ?

Thanks for the reply.
Is it possible to offset from a value that was chosen from a combobox in
another sheet?

I know the COLUMN (A) that the combobox value WILL be in but not the ROW?

Corey....

See my ealier post 2/1/2007 9:02am



"JLatham" <HelpFrom @ Jlathamsite.com.(removethis) wrote in message
...
To add some, you may also set up an offset to a known location (range) and
may refer to that range either by address or by its name if it is a named
range.

Range("A1").Offset(3,4) = 55
would put the value 55 into cell E4 (3 rows down, 4 columns to the right
of
A1)

If A1 had been named UpperLeft you could refer to it this way:
Range("UpperLeft").Offset(3,4)=55
same result

If you want/need to reference cells on a different sheet than the
currently
active sheet, preceed Range( with the sheet reference, either by name or
array number, name is usually easier to figure out.
Sheets("Sheet1").Range("UpperLeft").Offset(3,4) = 55

Obviously, the values used for row/column offsets can be calculated values
such as you might come up with inside of a loop.

"JLGWhiz" wrote:

Corey, this is out of the VBA Help file:

Worksheets("Sheet1").Activate
ActiveCell.Offset(rowOffset:=3, columnOffset:=3).Activate

This is the same thing in a tighter form:

Worksheets(1).Activate
ActiveCell.Offset(3, 3).Activate

You can find more info in the VBA Help file by typing Offset in the
search
boxEnter and select "Offset Property".


"Corey" wrote:

I have posted a few times without response, abut am in need of a method
using the offset(x, x) code.
I have never delt with this type of code before and so cannot workout
how to start it.
Do i need to set a target cell somehow, to start with so i can offset
cells from it ?

Can anyone assist me in this please?

Corey....