Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Auto expanding Range

What I have is a drop down menu, I want the input range to grow as I
add data to my table, without having to go back in and redefining the
range everytime.

It's telling me that my variable is not defined.

I very new to VBA, where am I going wrong?

Sub addrow()
bottom = Cells(65536, 23).End(xlUp).Row
Range("$W$19,bottom").Select
ActiveWorkbook.Names.Add Name:="enginetypes"
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Auto expanding Range

I figured outthe Variable, the Range is returned the "yellow highlight"

Sub addrow()
Dim bottom
bottom = Cells(65536, 23).End(xlUp).Row
Range("$W$19,bottom").Select
ActiveWorkbook.Names.Add Name:="enginetypes"
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Auto expanding Range

Hi Kevin,

Try:

Sub addrow()
Dim bottom As Long

bottom = Cells(65536, 23).End(xlUp).Row
ActiveWorkbook.Names.Add _
Name:="enginetypes", _
RefersTo:=Range("W19:W" & bottom)
End Sub


---
Regards,
Norman



wrote in message
oups.com...
What I have is a drop down menu, I want the input range to grow as I
add data to my table, without having to go back in and redefining the
range everytime.

It's telling me that my variable is not defined.

I very new to VBA, where am I going wrong?

Sub addrow()
bottom = Cells(65536, 23).End(xlUp).Row
Range("$W$19,bottom").Select
ActiveWorkbook.Names.Add Name:="enginetypes"
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Auto expanding Range

You my friend, are a GENIUS.

Just to go slightly further. I have it running the Macro on Open, how
would i get the Macro to run upon adding data to the next row?

I think I will make a forum eventually to run the Macro and add the
data, but for kicks...how would I?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Auto expanding Range

Hi Kevin,

Just to go slightly further. I have it running the Macro on Open, how
would i get the Macro to run upon adding data to the next row?


Rather than adopting a VBA approach, why not use a dynamic range?

If you are not familiar with the use of dynamic ranges, visit Debra
Dalgleish's Dynanic Ranges page at:

http://www.contextures.com/xlNames01.html#Dynamic


---
Regards,
Norman



wrote in message
oups.com...
You my friend, are a GENIUS.

Just to go slightly further. I have it running the Macro on Open, how
would i get the Macro to run upon adding data to the next row?

I think I will make a forum eventually to run the Macro and add the
data, but for kicks...how would I?





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Auto expanding Range

Sub addrow()

Range("$W$19:W" & _
Cells(65536, 23).End(xlUp).Row _
).Name:="enginetypes"
End Sub







--
Regards,
Tom Ogilvy

wrote in message
oups.com...
What I have is a drop down menu, I want the input range to grow as I
add data to my table, without having to go back in and redefining the
range everytime.

It's telling me that my variable is not defined.

I very new to VBA, where am I going wrong?

Sub addrow()
bottom = Cells(65536, 23).End(xlUp).Row
Range("$W$19,bottom").Select
ActiveWorkbook.Names.Add Name:="enginetypes"
End Sub



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
Auto expanding X Axis for Chart Corey[_4_] Charts and Charting in Excel 3 March 9th 10 02:56 PM
Auto expanding charts Martin Excel Worksheet Functions 3 July 28th 09 08:58 AM
Auto Expanding Range for array-entered IF veggies27 Excel Worksheet Functions 3 March 11th 08 03:02 PM
auto-expanding chart- dynamic ranges winewoman Excel Worksheet Functions 1 February 21st 08 07:38 PM
Auto Expanding Pie Chart Edgar Thoemmes Charts and Charting in Excel 1 February 9th 05 03:15 AM


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