ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selection command, problem with column index (https://www.excelbanter.com/excel-programming/384316-selection-command-problem-column-index.html)

Darron Ross[_3_]

selection command, problem with column index
 
I'm using the selection command and I'm havinig trouble with the columnindex.

With Selection
Range(.Cells, Cells(.Row, "iv")).Select
End With

The above works fine but when I use column instead if row as below:

With Selection
Range(.Cells, Cells(.Column, "6000")).Select
End With

I get an Run-time error 1004 application-defined or object-definde error

I believe it's because i'm not using the correct column indexing.


thanks for any help darron

Ron de Bruin

selection command, problem with column index
 
Hi Darron

It is Cells(row,column)

Not column,row

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Darron Ross" wrote in message ...
I'm using the selection command and I'm havinig trouble with the columnindex.

With Selection
Range(.Cells, Cells(.Row, "iv")).Select
End With

The above works fine but when I use column instead if row as below:

With Selection
Range(.Cells, Cells(.Column, "6000")).Select
End With

I get an Run-time error 1004 application-defined or object-definde error

I believe it's because i'm not using the correct column indexing.


thanks for any help darron


Vergel Adriano

selection command, problem with column index
 
Darron,

Try it this way:

With Selection
Range(.Cells, Cells(6000, .Column)).Select
End With



"Darron Ross" wrote:

I'm using the selection command and I'm havinig trouble with the columnindex.

With Selection
Range(.Cells, Cells(.Row, "iv")).Select
End With

The above works fine but when I use column instead if row as below:

With Selection
Range(.Cells, Cells(.Column, "6000")).Select
End With

I get an Run-time error 1004 application-defined or object-definde error

I believe it's because i'm not using the correct column indexing.


thanks for any help darron



All times are GMT +1. The time now is 01:32 PM.

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