Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to determine the height of a Range as an Integer


This is concerning my other post, but a much simpler version.

How do you determine the address of a Range in VBA?


--
TechWrangler


------------------------------------------------------------------------
TechWrangler's Profile: http://www.excelforum.com/member.php...o&userid=34244
View this thread: http://www.excelforum.com/showthread...hreadid=540004

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default How to determine the height of a Range as an Integer

use expression.Address

this code prints the address of the current selection to the Immediate
window
Sub PrintAddress()
Debug.Print Selection.Address
End Sub

somethinglikeant

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to determine the height of a Range as an Integer


Thanks for the quick response. I want to use this as my loop control
variable so I can loop through a varible size range and copy the
elements to another Worksheet. So it doesn't need to print. Would I
still use this?

Or would I do something like:

set r = Range ("CRP01")
Dim i = r.????
Dim crpCount = 2

For crpRow = crpCount To i
Code...
Next crpRow


--
TechWrangler


------------------------------------------------------------------------
TechWrangler's Profile: http://www.excelforum.com/member.php...o&userid=34244
View this thread: http://www.excelforum.com/showthread...hreadid=540004

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default How to determine the height of a Range as an Integer

r.Rows.Count will return the number of rows in the range.


--
Dick Kusleika
MS MVP - Excel
www.dailydoseofexcel.com

TechWrangler wrote:
Thanks for the quick response. I want to use this as my loop control
variable so I can loop through a varible size range and copy the
elements to another Worksheet. So it doesn't need to print. Would I
still use this?

Or would I do something like:

set r = Range ("CRP01")
Dim i = r.????
Dim crpCount = 2

For crpRow = crpCount To i
Code...
Next crpRow



  #5   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to determine the height of a Range as an Integer

Is there a specific reason to loop through each cell in the range to copy it
to the other sheet? If you know the beginning and ending cells of your
source range, and the upper left cell of your destination range you can just
copy the cells right over.


Dim rngCopy As Range
Dim rngDest As Range

Set rngCopy = Worksheets("Sheet2").Range(Range("Cell1"), _
Range("Cell2"))
Set rngDest = Worksheets("Sheet3").Range("A1")

rngCopy.Copy rngDest



"TechWrangler" wrote:


Thanks for the quick response. I want to use this as my loop control
variable so I can loop through a varible size range and copy the
elements to another Worksheet. So it doesn't need to print. Would I
still use this?

Or would I do something like:

set r = Range ("CRP01")
Dim i = r.????
Dim crpCount = 2

For crpRow = crpCount To i
Code...
Next crpRow


--
TechWrangler


------------------------------------------------------------------------
TechWrangler's Profile: http://www.excelforum.com/member.php...o&userid=34244
View this thread: http://www.excelforum.com/showthread...hreadid=540004




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to determine the height of a Range as an Integer


I am creating a template with the data that is copied into sheet1. The
user gets to choose which type of template they want and then it is
built using this macro. The ranges in both of the other sheets are
dynamic so I never know how big they are.

I would like to thank both JMB and Dick K. for the code snippets I will
use both of them.


--
TechWrangler


------------------------------------------------------------------------
TechWrangler's Profile: http://www.excelforum.com/member.php...o&userid=34244
View this thread: http://www.excelforum.com/showthread...hreadid=540004

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
What function to determine the second small integer from a list? Eric Excel Programming 5 January 4th 06 05:02 PM
What function to determine the second small integer from a list? Eric Excel Worksheet Functions 3 December 30th 05 11:56 PM
What function to determine the second small integer from a list? Eric Excel Discussion (Misc queries) 1 December 30th 05 02:05 PM
Determine if Integer is Odd or Even GoFigure[_18_] Excel Programming 7 December 13th 05 02:39 AM
Wanted func to determine height of ListBox row count Excel Programming 2 May 24th 04 06:38 PM


All times are GMT +1. The time now is 09:54 AM.

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"