View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
sb1920alk sb1920alk is offline
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,