Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default determining last column


I am trying to setup a print range based on variables My
formula is

Range("A" & iRStrt, " " & iRFin)

I've coded the iRStrt and iRFin bit which works out the
start and end rows, however you will notice the " ", this
is because I'm stuck with this bit. I don't want to hard
code it, ie I know the actual end column is "Y" but this
might change.
Elsewhere in my code I use the following formula to
determine my last column

iCCount = ActiveSheet.Range("IV7").End(xlToLeft).Column

however this returns an integer value, how would I get the
equivalent but expressed as the column letter?

Does this make sense?
Am I going about this the right way?
Can anyone help?

Many thanks
Jacqui
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default determining last column

You can use the Cells function. For example, to select
range B1:J10, you can use:

Range(Cells(1,2).Address & ":" & Cells
(10,10).Address).Select

Just change the hard coded integer values to variables to
suit your needs.


-----Original Message-----

I am trying to setup a print range based on variables My
formula is

Range("A" & iRStrt, " " & iRFin)

I've coded the iRStrt and iRFin bit which works out the
start and end rows, however you will notice the " ", this
is because I'm stuck with this bit. I don't want to hard
code it, ie I know the actual end column is "Y" but this
might change.
Elsewhere in my code I use the following formula to
determine my last column

iCCount = ActiveSheet.Range("IV7").End(xlToLeft).Column

however this returns an integer value, how would I get

the
equivalent but expressed as the column letter?

Does this make sense?
Am I going about this the right way?
Can anyone help?

Many thanks
Jacqui
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default determining last column

if icCount returns the last column -
then your print range formula is

Range(cells(iRStrt,icCount),cells(iRFin,icCount))

you did 98% of it yourself ... well done

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----

I am trying to setup a print range based on variables

My
formula is

Range("A" & iRStrt, " " & iRFin)

I've coded the iRStrt and iRFin bit which works out the
start and end rows, however you will notice the " ",

this
is because I'm stuck with this bit. I don't want to

hard
code it, ie I know the actual end column is "Y" but this
might change.
Elsewhere in my code I use the following formula to
determine my last column

iCCount = ActiveSheet.Range("IV7").End(xlToLeft).Column

however this returns an integer value, how would I get

the
equivalent but expressed as the column letter?

Does this make sense?
Am I going about this the right way?
Can anyone help?

Many thanks
Jacqui
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default determining last column

Try this

Range("A" & iRStrt, Cells(iRFin, iCCount)).Select


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"jacqui" wrote in message ...

I am trying to setup a print range based on variables My
formula is

Range("A" & iRStrt, " " & iRFin)

I've coded the iRStrt and iRFin bit which works out the
start and end rows, however you will notice the " ", this
is because I'm stuck with this bit. I don't want to hard
code it, ie I know the actual end column is "Y" but this
might change.
Elsewhere in my code I use the following formula to
determine my last column

iCCount = ActiveSheet.Range("IV7").End(xlToLeft).Column

however this returns an integer value, how would I get the
equivalent but expressed as the column letter?

Does this make sense?
Am I going about this the right way?
Can anyone help?

Many thanks
Jacqui



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default determining last column

Heres a couple of ways of doing it:-

Range("C3").Select
ActiveWorkbook.Names.Add Name:="start", RefersToR1C1:=ActiveCell
Selection.End(xlToRight).Select
Selection.End(xlDown).Select
ActiveWorkbook.Names.Add Name:="finish", RefersToR1C1:=ActiveCell
Application.Goto Reference:="start:finish"


StartR = ActiveCell.Row
StartC = ActiveCell.Column
Selection.End(xlToRight).Select
Selection.End(xlDown).Select
FinishR = ActiveCell.Row
FinishC = ActiveCell.Column
Range(Cells(StartR, StartC), Cells(FinishR, FinishC)).Select


Dave





"jacqui" wrote in message ...
I am trying to setup a print range based on variables My
formula is

Range("A" & iRStrt, " " & iRFin)

I've coded the iRStrt and iRFin bit which works out the
start and end rows, however you will notice the " ", this
is because I'm stuck with this bit. I don't want to hard
code it, ie I know the actual end column is "Y" but this
might change.
Elsewhere in my code I use the following formula to
determine my last column

iCCount = ActiveSheet.Range("IV7").End(xlToLeft).Column

however this returns an integer value, how would I get the
equivalent but expressed as the column letter?

Does this make sense?
Am I going about this the right way?
Can anyone help?

Many thanks
Jacqui

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
Determining the Age of a Person mpenkala Excel Worksheet Functions 5 December 21st 06 02:48 PM
Determining if a value already exists in column(s) Rookie_User Excel Discussion (Misc queries) 0 October 3rd 06 05:32 PM
Determining the current row and col k483 Excel Discussion (Misc queries) 2 November 25th 05 05:50 PM
need help with determining a formula Cal Excel Worksheet Functions 2 November 11th 05 01:49 PM
Determining a Date Mark Excel Discussion (Misc queries) 1 July 1st 05 03:13 PM


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