Resize Range for Column in Workbook

June 23, 2009 by vba excel
Filed under: Excel Spreadsheet, Excel Tips, Excel Worksheet 
Sponsor

Resize Range for Column in Workbook [Q]

I dont know how to resize range for column in excel workbook, i have four named ranges that relate to a column of data starting on row 1 going
to the end of the column data on my excel spreadsheet.

The columns on my excel spreadsheet may resize periodically since rows of data will be added. How do I write code that will name the range taking into account that each of the columns may resize and the range, therefore, will need to resize. If I use “Current Region” it selects the whole table of data since the columns are contiguous. I only want the range to select a column of data. I am currently using the following excel code to name ranges, but it is not
dynamic if the column resizes by adding another row.

Range(”A1″).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Names.Add Name:=”ID”, RefersToR1C1:= _
“=Assignment!R1C1:R34C1″

Range(”B1″).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Names.Add Name:=”ZLow”, RefersToR1C1:= _
“Assignment!R1C2:R34C2″

Range(”C1″).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Names.Add Name:=”ZHigh”, RefersToR1C1:= _
“=Assignment!R1C3:R34C3″

Range(”D1″).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Names.Add Name:=”Dnt”, RefersToR1C1:= _
“=Assignment!R1C4:R34C4″

Resize Range for Column in Workbook [A]

Here’s excel tips solution for you to resize range for column in excel workbook :

Use insert > name > define > name it ID>type in
=offset($a$1,0,0,match(99999999,$a:$a),1)
if col a has letters instead us “zzzzzzzzzz”
then col b
=offset(ID,0,1)
etc
Now, the ranges will be self-adjusting based on the last cell in col A

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google
  • E-mail this story to a friend!
  • Live
  • MisterWong
  • Propeller
  • StumbleUpon
  • Technorati
  • TwitThis
  • YahooMyWeb
  • Print this article!

Rate This Tips:

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...


Incoming excel search terms

vba resize range,excel vba resize column,excel vba resize columns,excel vba resize range,vba resize column,excel resize function,resize excel spreadsheet,excel vba resize,vba resize,range resize,excel resize range,excel vba resize named range,vba range resize,excel range resize,excel resize named range,resize range vba,excel vba range resize,excel vba resize selection,vba resize columns,vba resize selection,how to resize excel spreadsheet,mss,range resize vba,,resize range excel,vba excel resize column,excel column range,excel visual basic resize column,resize function excel,resize named range excel,resize named range vba,resize range excel vba,excel macro resize column,excel macro resize range,excel offset resize,excel resize,excel sheet range resize,how to resize a spreadsheet,how to resize columns in excel,offset and resize in excel vba,resize function vba,resize range,resize spreadsheet,resize vba excel,vba excel resize,vba resize cell,column range,excel resize columns vba,excel resize selection,how to resize spreadsheet



Related Excel Tips

Comments

One Comment on Resize Range for Column in Workbook

    [...] View original post here: Excel Spreadsheet Resize Range for Column in Workbook [...]

Have another excel answer or questions for this problem ?
Feel free to post it here..