Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default detecting range of spreadsheet


Hi,

I'm trying to design a simple spreadsheet that does some accounting
calculation and then represents them in a variety of charts. I'm
simply using macros through demonstration rather than coding. I was
wondering how one might be able to use VBA to detect the bottom right
most range Y coordinate(X letter is predertimed - number of fields in
spreadsheet) so the macro will run correctly regardless of how many
rows there are?

Thanks ahead,
Altein




--
altein
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 11,058
Default detecting range of spreadsheet

Here is some code to give the limits of UsedRange:

Set r = ActiveSheet.UsedRange

nLastRow = r.Rows.Count + r.Row - 1
MsgBox ("last row " & nLastRow)

nLastColumn = r.Columns.Count + r.Column - 1
MsgBox ("last column " & nLastColumn)

nFirstRow = r.Row
MsgBox ("first row " & nFirstRow)

nFirstColumn = r.Column
MsgBox ("first column " & nFirstColumn)

numrow = r.Rows.Count
MsgBox ("number of rows " & numrow)

numcol = r.Columns.Count
MsgBox ("number of columns " & numcol)

--
Gary''s Student - gsnu2007d


"altein" wrote:


Hi,

I'm trying to design a simple spreadsheet that does some accounting
calculation and then represents them in a variety of charts. I'm
simply using macros through demonstration rather than coding. I was
wondering how one might be able to use VBA to detect the bottom right
most range Y coordinate(X letter is predertimed - number of fields in
spreadsheet) so the macro will run correctly regardless of how many
rows there are?

Thanks ahead,
Altein




--
altein

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
Detecting text and returning a value Confuddled User!!!!!!!!!!!!! Excel Discussion (Misc queries) 6 August 28th 07 04:04 PM
detecting proxy settings Russell Johnson Excel Discussion (Misc queries) 0 February 26th 07 01:16 AM
Detecting Oldest Date On Spreadsheet Keiron James Keeble Excel Discussion (Misc queries) 3 January 19th 05 01:09 AM
Detecting absentees gracegift Excel Discussion (Misc queries) 7 December 27th 04 11:35 PM
Detecting a color Duncan Help Excel Worksheet Functions 5 December 9th 04 08:12 PM


All times are GMT +1. The time now is 08:16 PM.

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"