LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default define variable range

Hello -

I'm modifying some code from Dave McRitchie to create a TOC and need
some help ...

I've set up an InputBox where users select a cell, which should become
the upper-left corner of the TOC -- this cell is called 'StartCell'.
The code goes on to establish the range (rg), which is seven columns
by the number of sheets in the book. For example:
StartCell = A2
ActiveWorkbook.Sheets.Count = 10
RESULT should be that rg = A2:G12

Here's the code with my latest attempt to make it happen:
Set rg = Range(StartCell, Cells(ActiveWorkbook.Sheets.Count,
StartCell.Offset(0, 7)))

what am I doing wrong?

tia, ray

 
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
Define variable range input for SUM() function JeffC Excel Worksheet Functions 4 May 16th 09 03:54 AM
Define Variable Name using VBA GTReferee Excel Discussion (Misc queries) 2 January 21st 09 06:37 PM
Define Range Name with variable row value wayliff[_11_] Excel Programming 2 January 17th 06 03:23 PM
How to define variable kishore Excel Programming 3 May 13th 05 10:22 AM
Define variable range acberry Excel Programming 2 May 12th 04 02:44 PM


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