Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Obvious, but couldn't find this either

I tried to use the OFFSET function within my VBA code, but the compiler
doesn't recognize it (which is wierd, because when I make a function, it is
visible in vba as a function for a cell). I'm sure there's a way to do it,
I'm just missing it. Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default Obvious, but couldn't find this either


Did you inform Excel what the offset is in relation to?

Range("A1").Offset(1,2).Value

ActiveCell.Offset(3,1).Select

--
Kevin Backmann


"Gary F" wrote:

I tried to use the OFFSET function within my VBA code, but the compiler
doesn't recognize it (which is wierd, because when I make a function, it is
visible in vba as a function for a cell). I'm sure there's a way to do it,
I'm just missing it. Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Obvious, but couldn't find this either

I was actually trying to use the Offset function, not the range offset
method.... but it now occurs to me that you use excel functions in
cells/ranges. e.g., you click on A1 and type "=OFFSET(...)", so I'm sure
that what I have to do is something like

1. instantiate a cell (range)
2. set #2s value to "=OFFSET([parm1],...[parm4]")
3. catch the result

Right? The offset function I"m referring to is the one you get when you're
in a spreadsheet and you look at the list of available functions. I could be
just as well referring to any of the functions "ABS, VLOOKUP", etc.

Thanks

"Kevin B" wrote:


Did you inform Excel what the offset is in relation to?

Range("A1").Offset(1,2).Value

ActiveCell.Offset(3,1).Select

--
Kevin Backmann


"Gary F" wrote:

I tried to use the OFFSET function within my VBA code, but the compiler
doesn't recognize it (which is wierd, because when I make a function, it is
visible in vba as a function for a cell). I'm sure there's a way to do it,
I'm just missing it. Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Obvious, but couldn't find this either

Does this help?

Inserting a Worksheet Function into a Cell
To insert a worksheet function into a cell, you specify the function as the
value of the Formula property of the corresponding Range object. In the
following example, the RAND worksheet function (which generates a random
number) is assigned to the Formula property of range A1:B3 on Sheet1 in the
active workbook.

Sub InsertFormula()
Worksheets("Sheet1").Range("A1:B3").Formula = "=OFFSET()"
End Sub



"Gary F" wrote:

I was actually trying to use the Offset function, not the range offset
method.... but it now occurs to me that you use excel functions in
cells/ranges. e.g., you click on A1 and type "=OFFSET(...)", so I'm sure
that what I have to do is something like

1. instantiate a cell (range)
2. set #2s value to "=OFFSET([parm1],...[parm4]")
3. catch the result

Right? The offset function I"m referring to is the one you get when you're
in a spreadsheet and you look at the list of available functions. I could be
just as well referring to any of the functions "ABS, VLOOKUP", etc.

Thanks

"Kevin B" wrote:


Did you inform Excel what the offset is in relation to?

Range("A1").Offset(1,2).Value

ActiveCell.Offset(3,1).Select

--
Kevin Backmann


"Gary F" wrote:

I tried to use the OFFSET function within my VBA code, but the compiler
doesn't recognize it (which is wierd, because when I make a function, it is
visible in vba as a function for a cell). I'm sure there's a way to do it,
I'm just missing it. Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Obvious, but couldn't find this either

Why wouldn't you use the offset property of the range object in VBA? it is
faster, readily available and would accomplish the same thing.

=Offset(A1,3,5)

range("A1").Offset(3,5).Value

3 steps for the first approach (as you have laid them out), 1 step for the
second.

--
Regards,
Tom Ogilvy


"Gary F" wrote:

I was actually trying to use the Offset function, not the range offset
method.... but it now occurs to me that you use excel functions in
cells/ranges. e.g., you click on A1 and type "=OFFSET(...)", so I'm sure
that what I have to do is something like

1. instantiate a cell (range)
2. set #2s value to "=OFFSET([parm1],...[parm4]")
3. catch the result

Right? The offset function I"m referring to is the one you get when you're
in a spreadsheet and you look at the list of available functions. I could be
just as well referring to any of the functions "ABS, VLOOKUP", etc.

Thanks

"Kevin B" wrote:


Did you inform Excel what the offset is in relation to?

Range("A1").Offset(1,2).Value

ActiveCell.Offset(3,1).Select

--
Kevin Backmann


"Gary F" wrote:

I tried to use the OFFSET function within my VBA code, but the compiler
doesn't recognize it (which is wierd, because when I make a function, it is
visible in vba as a function for a cell). I'm sure there's a way to do it,
I'm just missing it. Thanks!

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
I know this is obvious but .. Bony Pony[_3_] Excel Worksheet Functions 3 March 9th 10 01:23 PM
cannot activate smart tags - tried all the obvious sinclaira Excel Discussion (Misc queries) 0 March 12th 07 04:22 PM
A Really Stupid Obvious Question that is Driving Me Nuts Capt. Attitude Excel Discussion (Misc queries) 2 October 18th 06 06:23 PM
Must Be Missing Something Obvious About ListBoxes Johnny Meredith Excel Programming 2 June 4th 05 08:49 AM
Not so obvious Chart? rvExcelNewTip Charts and Charting in Excel 4 June 1st 05 05:14 PM


All times are GMT +1. The time now is 06:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"