LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Defining Names for variable ranges Using VB


Excel 2000
I am importing data, which consists of several “tables” separated by
blank rows. The size of the tables varies so I need to name the tables
in the macro, not before hand. I have the code I used below. First, I
go to the beginning of the data (Cell B6), then select the first set of
data, try to name it (Table1) and then select the second set of data
and try to name that. I think the error is definitely in the line
where I name the tables but I am not sure how that should be worded.
I tried doing it manually using “Record Macro” but that gave me
specific ranges, which did not alter with newly imported data. Anyone
have any ideas? Thanks in advance.

'Name Table1 and Table2
'
Range("B6").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveWorkbook.Names.Add Name:="TABLE1", RefersToR1C1:= _
Active.Selection
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveWorkbook.Names.Add Name:="TABLE2", RefersToR1C1:= _
Active.Selection

ChemistB


--
ChemistB
------------------------------------------------------------------------
ChemistB's Profile: http://www.excelforum.com/member.php...o&userid=12741
View this thread: http://www.excelforum.com/showthread...hreadid=541141

 
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
Defining identical names that represent different ranges of cells Bernard Excel Discussion (Misc queries) 2 August 31st 06 07:54 AM
Counting variable ranges and auto-summing variable ranges Father Guido[_5_] Excel Programming 2 March 29th 06 04:07 AM
Defining Ranges Steve Excel Worksheet Functions 5 May 28th 05 07:41 AM
Re-defining Ranges in VBA aehan Excel Programming 3 March 24th 05 05:15 PM
Defining Ranges Greg Ghavalas Excel Programming 2 July 9th 03 10:10 PM


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