Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bij Bij is offline
external usenet poster
 
Posts: 1
Default How can I dynamically change the range for Range("A1:M500")?

I initially clear the following Range("A1:M500") in one of my worksheets.
Using VB, I add data to this worksheet so only 10-20 rows have data. How do
I change my range dynamically based on the number of rows with data and
columns with data?

Reason I want to do this is because I want to set my print area in VB.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default How can I dynamically change the range for Range("A1:M500")?

ActiveSheet.PageSetup.PrintArea = Range("A1").CurrentRegion

"Bij" wrote:

I initially clear the following Range("A1:M500") in one of my worksheets.
Using VB, I add data to this worksheet so only 10-20 rows have data. How do
I change my range dynamically based on the number of rows with data and
columns with data?

Reason I want to do this is because I want to set my print area in VB.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default How can I dynamically change the range for Range("A1:M500")?

Sorry, NOT working. Have to try harder.

"PY & Associates" wrote:

ActiveSheet.PageSetup.PrintArea = Range("A1").CurrentRegion

"Bij" wrote:

I initially clear the following Range("A1:M500") in one of my worksheets.
Using VB, I add data to this worksheet so only 10-20 rows have data. How do
I change my range dynamically based on the number of rows with data and
columns with data?

Reason I want to do this is because I want to set my print area in VB.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default How can I dynamically change the range for Range("A1:M500")?

You nearly had it:

ActiveSheet.PageSetup.PrintArea = Range("A1").CurrentRegion.Address

Regards
Rowan

"PY & Associates" wrote:

Sorry, NOT working. Have to try harder.

"PY & Associates" wrote:

ActiveSheet.PageSetup.PrintArea = Range("A1").CurrentRegion

"Bij" wrote:

I initially clear the following Range("A1:M500") in one of my worksheets.
Using VB, I add data to this worksheet so only 10-20 rows have data. How do
I change my range dynamically based on the number of rows with data and
columns with data?

Reason I want to do this is because I want to set my print area in VB.

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
please change Range("AB30").Select to any cell Steved Excel Worksheet Functions 3 October 18th 09 10:03 PM
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
"deselect ?" a range or change state from edit to ? mark kubicki Excel Programming 0 August 11th 04 07:34 PM


All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"