Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBA get range from cell offset

I have a macro that allows pictures to be added to a cell defined as a
range and, as such, takes the range as an input i.e.

Sub InsertPicture(PictureFileName As String, TargetCell As Range, _
CenterH As Boolean, CenterV As Boolean)

However, my main code is using cell offsets in all of the processing
and I am unsure as to how to convert my offset cell to the TargetCell
value required above i.e.

Set fdcCell = FDCs.Cells(fdcrownumber, 1) -- the initial cell
definition

The cell I need to find the range value for is fdcCell.Offset(0, 18)

I guess I have to create a range variable such as "Dim pictRange As
Range"

What is the command to set this pictRange value to that of the cell
defined by offset fdcCell.Offset(0, 18) ??

Cannot get this right!!

Cheers
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default VBA get range from cell offset

On May 17, 4:30*pm, stainless wrote:
Sub InsertPicture(PictureFileName As String, _
TargetCell As Range, _
* * CenterH As Boolean, CenterV As Boolean)

However, my main code is using cell offsets in all
of the processing and I am unsure as to how to convert
my offset cell to the TargetCell value required above i.e.

Set fdcCell = FDCs.Cells(fdcrownumber, 1) -- the initial
cell definition

The cell I need to find the range value for is
fdcCell.Offset(0, 18)


I'm a bit confused. Why can't you simply pass fdcCell.Offset(0,18)
directly as the 2nd parameter to InsertPicture?

fdcCell.Offset(0,18) returns a Range of a single cell, given how you
set fdcCell in the first place. Look at fdcCell.Offset(0,18).Address.

Are you looking for a multicell range? Is so, what defines the limits
of the range? Look at something like
Range(fdcCell.Offset(0,18),fcdCell.Offset(5,22)).A ddress.

(Just making things up to demonstrate concepts.)

Note: Although I use .Address to display the ranges, you would pass
the object without .Address to the TargetCell parameter.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBA get range from cell offset


I'm a bit confused. *Why can't you simply pass fdcCell.Offset(0,18)
directly as the 2nd parameter to InsertPicture?


It is me that is confused. I did not know that simply passing in the
Offset cell would satisfy the Range variable.

I will give it a go and get back to you with the results.

Thanks for your help.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBA get range from cell offset

On May 18, 9:51*pm, stainless wrote:
I'm a bit confused. *Why can't you simply pass fdcCell.Offset(0,18)
directly as the 2nd parameter to InsertPicture?


It is me that is confused. I did not know that simply passing in the
Offset cell would satisfy the Range variable.

I will give it a go and get back to you with the results.

Thanks for your help.


I tried fdcCell.Offset(0,18) and fdcCell.Offset(0,18).Address, and in
both cases, the TargetCell range value on entry to the sub
InsertPicture was empty.Have I misunderstood again?
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
Sum variable range of column entries in offset cell Struggling in Sheffield[_2_] New Users to Excel 5 October 10th 09 05:16 PM
Moving into a cell range using Offset and LBound TISR Excel Programming 2 March 26th 06 11:56 PM
Offset Function works in cell, not in named range DragonslayerApps Excel Worksheet Functions 0 July 25th 05 04:39 PM
Selecting a range offset from a cell Beeegr8 Excel Programming 2 April 1st 05 08:02 PM
Selecting cell using range.offset presence76[_3_] Excel Programming 2 June 9th 04 03:46 PM


All times are GMT +1. The time now is 07:50 PM.

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

About Us

"It's about Microsoft Excel"