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

I am using the OWC and i need to build a range from another range
using a starting cell.

So i have
src.address = "A23:AA24"
dest.address = "A27"

I need to calculate the end of the range based on the dest.address
cell.
the end result would be

dest.address = "A27:AA28"

I need to do this wil Excel vba... any ideas?

thanks
TT

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Build a range from a cell

Try this:

Dim src As Range
Dim dest As Range

Set src = Range("A23:AA24")
Set dest = Range("A27")

Set dest = src.Offset(dest.Row - src.Row, dest.Column - src.Column)





" wrote:

I am using the OWC and i need to build a range from another range
using a starting cell.

So i have
src.address = "A23:AA24"
dest.address = "A27"

I need to calculate the end of the range based on the dest.address
cell.
the end result would be

dest.address = "A27:AA28"

I need to do this wil Excel vba... any ideas?

thanks
TT


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Build a range from a cell

Set src = Range("A23:AA24")
Set dest = Range("A27")

With src
Set dest = dest.Resize(.Rows.Count, .Columns.Count)
End With

Debug.Print dest.Address ' $A$27:$AA$28

Before resizing you might also want to ensure the new range does would not
extend off the sheet.

Regards,
Peter T

wrote in message
ps.com...
I am using the OWC and i need to build a range from another range
using a starting cell.

So i have
src.address = "A23:AA24"
dest.address = "A27"

I need to calculate the end of the range based on the dest.address
cell.
the end result would be

dest.address = "A27:AA28"

I need to do this wil Excel vba... any ideas?

thanks
TT



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Build a range from a cell

Give this a whirl...

Sub test()
Dim src As Range
Dim dest As Range

Set src = Range("A23:AA24")
Set dest = Range("A27").Resize(src.Rows.Count, src.Columns.Count)
MsgBox dest.Address
End Sub
--
HTH...

Jim Thomlinson


" wrote:

I am using the OWC and i need to build a range from another range
using a starting cell.

So i have
src.address = "A23:AA24"
dest.address = "A27"

I need to calculate the end of the range based on the dest.address
cell.
the end result would be

dest.address = "A27:AA28"

I need to do this wil Excel vba... any ideas?

thanks
TT


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
How do I re - build border of my cell? PL Excel Discussion (Misc queries) 1 July 10th 09 05:11 AM
build a chart in a cell Curtis Excel Discussion (Misc queries) 3 August 1st 07 05:19 PM
HD I build funct @if cell=AorBorC then ...else if cell=DorE then Jocko_MacDuff116 Excel Worksheet Functions 8 August 15th 05 01:16 PM
How to build a forward/back range finder John Wirt[_10_] Excel Programming 1 July 24th 05 09:21 PM
How to build build a macro that automatically imports PedroPeso Excel Programming 1 December 26th 03 08:14 PM


All times are GMT +1. The time now is 04:41 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"