Thread: Help with macro
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Ken G. Ken G. is offline
external usenet poster
 
Posts: 37
Default Help with macro

Thanks once more. There's not much I can do other than simplify the problem.
Its a complex workbook of 14 worksheets and I don't think I could explain it
well enough without sending or posting the whole workbook (which I can't do).
Both the source data range, and the target range are determined by values in
other worksheets, and I've used the indirect function to successfully select
the source data, but couldn't figure out a formula to select the target
range, and I was hoping there'd be a similar function to "indirect" in VB,
but since there's not, its back to the drawing board ....

Thanks anyway.

"Rick Rothstein" wrote:

Don't "simplify"... it doesn't really help. First off, you don't need to use
the Indirect function, mainly because VB doesn't have one. In order for us
to be able to help you, you need to tell us where your source data is, how
you determine what part of it you want and how you determine where to put it
(all of that in detail). We will be more than happy to show you how do
accomplish what you want, but you need to give us the details so that we can
figure out what you are simply taking for granted that you know.

--
Rick (MVP - Excel)


"Ken G." wrote in message
...
Thanks Rick. The reason for using indirect is that the cell where the
range
paste will start depends on the results of other calculations. To simplify
it, I have a range of monthly loan repayments. These are to be pasted into
another worksheet, but the first cell of the target range is determined by
a
number of months by which the first loan repayment is deferred. Could be
3,
4, 6 etc. - its a variable, and that's why I'm trying to use the indirect
function so that I can offset the target range by the number of deferred
months. I know how it works in excel, I don't know how (if) it works in
VBA.

"Rick Rothstein" wrote:

Why do you think you need to use the Indirect function to do this? Using
sample ranges and sheet names (because you didn't tell us what you
actually
are working with), this single line of code...

Worksheets("Sheet1").Range("A1:F99").Copy
Worksheets("Sheet2").Range("C3")

will copy A1:F99 on Sheet1 (with its formatting) to Sheet2 starting at
cell
C3.

--
Rick (MVP - Excel)


"Ken G." wrote in message
...
I need to copy a range from one worksheet and paste the values into
another
sheet within the same workbook, but I need to use the Excel "Indirect"
function to paste it into the correct position. How is this done with a
macro? (Excel 2002)