Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default How to grab a reference into VB

I have a macro that publishes a sheet as a webpage in the range "$A$1:$K$56"
but I'd like to change it to "$A$1:$K$**" instead where the ** number is
pulled from a cell, say P1 based on the result of a formula in P1 because I
have to manually change the macro every time the number of rows changes. Is
that possible?

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to grab a reference into VB

you should be able to use:
Range("A1:K" & Range("P1").Value)

assuming you are working with the activesheet. otherwise qualify the range
references with the proper worksheet references.

"sb1920alk" wrote:

I have a macro that publishes a sheet as a webpage in the range "$A$1:$K$56"
but I'd like to change it to "$A$1:$K$**" instead where the ** number is
pulled from a cell, say P1 based on the result of a formula in P1 because I
have to manually change the macro every time the number of rows changes. Is
that possible?

Thanks,

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default How to grab a reference into VB

"A1:K" & Range("P1").Value is what worked, I kept getting an error with
Range("A1:K" & Range("P1").Value)

Thanks for pointing me in the right direction.

"JMB" wrote:

you should be able to use:
Range("A1:K" & Range("P1").Value)

assuming you are working with the activesheet. otherwise qualify the range
references with the proper worksheet references.

"sb1920alk" wrote:

I have a macro that publishes a sheet as a webpage in the range "$A$1:$K$56"
but I'd like to change it to "$A$1:$K$**" instead where the ** number is
pulled from a cell, say P1 based on the result of a formula in P1 because I
have to manually change the macro every time the number of rows changes. Is
that possible?

Thanks,

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
number grab David New Users to Excel 5 July 20th 06 10:45 PM
grab detail when = 1 jenn Excel Worksheet Functions 0 January 12th 06 09:06 PM
Numeric reference of column. Data Grab ? bigexcelfan Excel Discussion (Misc queries) 3 January 4th 06 11:26 PM
Grab name of folder scantor145[_13_] Excel Programming 1 July 1st 05 01:17 PM
Grab Password Name Paul P[_3_] Excel Programming 3 October 24th 03 01:07 AM


All times are GMT +1. The time now is 11:51 AM.

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"