ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   slightly confused - object reference (https://www.excelbanter.com/excel-programming/417745-slightly-confused-object-reference.html)

PBcorn

slightly confused - object reference
 
i have code looking a little like this:

sub test()

dim sht as worksheet
dim cll as range

for each sht in thisworkbook.worksheets

<more code here

for each cll in sht.usedrange.columns(2).cells

sht.range(cll).select*

<code to do soething with selection

next cll

next sht


the problem is that the starred line is wrong, but i have tried everything
from sht.cll.select to sht.range("cll").select nothing works. I Just want to
select the cell so i can insert a row above it. Any help appreciated.

end sub

Bob Phillips

slightly confused - object reference
 
Try just

cll.Select

you have already drilled down to the individual cell, so you don't need the
sheet reference.

YOu don't need to select you could just referernce cll.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"PBcorn" wrote in message
...
i have code looking a little like this:

sub test()

dim sht as worksheet
dim cll as range

for each sht in thisworkbook.worksheets

<more code here

for each cll in sht.usedrange.columns(2).cells

sht.range(cll).select*

<code to do soething with selection

next cll

next sht


the problem is that the starred line is wrong, but i have tried everything
from sht.cll.select to sht.range("cll").select nothing works. I Just want
to
select the cell so i can insert a row above it. Any help appreciated.

end sub





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

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