How to offset a row

  • Thread starter Thread starter axwack
  • Start date Start date
A

axwack

I have the following problem.

I need to dynamically create a formula by the amount of values in a
dynamically created column. THe columns get populated by the number of
entries in the DB.

For example:

A B
----- ----
a
b
c
=sum(b3:b1)

The sum function is derived by figuring out the number of values in a.

I can get the range offset for the starting point but I want to be
able to get the total values form the offset.

Here is an example of my code:

Debug.Print "Formula: " & rng.Offset(0, 1).Address & ":" &
rng.End(xlUp).Address <----

This formula is calculating the address up to A1...I need it to
convert to B1

Any thoughts?
 
hi
try this
Dim rng As Range
Set rng = Range("A1:A3")
Debug.Print "Formula:=" & rng.Offset(0, 1).Address

your way produces
Formula:=$B$1:$B$3:$A$1

Regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top