ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Find the Column address from a Range Dimensioned Variable (https://www.excelbanter.com/excel-programming/426321-how-find-column-address-range-dimensioned-variable.html)

ironhydroxide

How to Find the Column address from a Range Dimensioned Variable
 
I am trying to use a Range demensioned variable as a column address in a
..Cells(... command to give another variable a cell address.

It Looks a little Like THis

DescriptionP3 = Sheets("5-year Plan").Cells(LoopedRowFrom, GeneralDisc.Column)

I am Fairly certain that the problem is with the GeneralDisc variable.

Thanks for all Suggestions

Jacob Skaria

How to Find the Column address from a Range Dimensioned Variable
 
Hope the below examples will help. .Column and .Row returns the column and
row of the first column and first row in the range

Example :
Set myRange = Range("A1:E20")
myRange.Column will return 1
myRange.Row will return 1

Set myRange = Range("E1:E20")
myRange.Column will return 5
myRange.Row will return 1


If this post helps click Yes
---------------
Jacob Skaria


"Ironhydroxide" wrote:

I am trying to use a Range demensioned variable as a column address in a
.Cells(... command to give another variable a cell address.

It Looks a little Like THis

DescriptionP3 = Sheets("5-year Plan").Cells(LoopedRowFrom, GeneralDisc.Column)

I am Fairly certain that the problem is with the GeneralDisc variable.

Thanks for all Suggestions


ironhydroxide

How to Find the Column address from a Range Dimensioned Variab
 
FOund out myself, (yours sounded a little too bookish)


With GeneralDisc
.Select
BetweenGeneral = ActiveCell.Column
End With

DescriptionP3 = Sheets("5-year Plan").Cells(LoopedRowFrom, BetweenGeneral)

I didnt realize that i had to go through another step to do this. i figured
it could calculate it in the .Cells( , ) command.

"Jacob Skaria" wrote:

Hope the below examples will help. .Column and .Row returns the column and
row of the first column and first row in the range

Example :
Set myRange = Range("A1:E20")
myRange.Column will return 1
myRange.Row will return 1

Set myRange = Range("E1:E20")
myRange.Column will return 5
myRange.Row will return 1


If this post helps click Yes
---------------
Jacob Skaria


"Ironhydroxide" wrote:

I am trying to use a Range demensioned variable as a column address in a
.Cells(... command to give another variable a cell address.

It Looks a little Like THis

DescriptionP3 = Sheets("5-year Plan").Cells(LoopedRowFrom, GeneralDisc.Column)

I am Fairly certain that the problem is with the GeneralDisc variable.

Thanks for all Suggestions



All times are GMT +1. The time now is 12:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com